History

ethtool: Add helper routines to pass vf to rx_flow_spec

The ring_cookie is 64 bits wide which is much larger than can be used for actual queue index values. So provide some helper routines to pack a VF index into the cookie. This is useful to steer packets to a VF ring without having to know the queue layout of the device.

John Fastabend committed 11 years ago

Commit 8cf6f491 parent ed2dfd91 file · +25 −0Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/ethtool.h+25−0
@@ -796,6 +796,31 @@ struct ethtool_rx_flow_spec { · 795 unmodified lines
796 __u32 location;796 __u32 location;
797};797};
798 798
799/* How rings are layed out when accessing virtual functions or
800 * offloaded queues is device specific. To allow users to do flow
801 * steering and specify these queues the ring cookie is partitioned
802 * into a 32bit queue index with an 8 bit virtual function id.
803 * This also leaves the 3bytes for further specifiers. It is possible
804 * future devices may support more than 256 virtual functions if
805 * devices start supporting PCIe w/ARI. However at the moment I
806 * do not know of any devices that support this so I do not reserve
807 * space for this at this time. If a future patch consumes the next
808 * byte it should be aware of this possiblity.
809 */
810#define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL
811#define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL
812#define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
813static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
814{
815 return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
816};
817
818static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
819{
820 return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
821 ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
822};
823
799/**824/**
800 * struct ethtool_rxnfc - command to get or set RX flow classification rules825 * struct ethtool_rxnfc - command to get or set RX flow classification rules
801 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,826 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,