]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ethtool: Add helper routines to pass vf to rx_flow_spec
authorJohn Fastabend <john.r.fastabend@intel.com>
Tue, 26 May 2015 15:22:49 +0000 (08:22 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Thu, 27 Aug 2015 15:00:23 +0000 (08:00 -0700)
Orabug: 21669416

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.

CC: Alex Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 8cf6f497de405ca9eb87ffb34d90699962d10125)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
include/uapi/linux/ethtool.h

index 2e49fc880d29a31bc167142748b23356c1b72005..e367dfe861896f0b05b7f4d11e772c41d8bdaab7 100644 (file)
@@ -796,6 +796,31 @@ struct ethtool_rx_flow_spec {
        __u32           location;
 };
 
+/* How rings are layed out when accessing virtual functions or
+ * offloaded queues is device specific. To allow users to do flow
+ * steering and specify these queues the ring cookie is partitioned
+ * into a 32bit queue index with an 8 bit virtual function id.
+ * This also leaves the 3bytes for further specifiers. It is possible
+ * future devices may support more than 256 virtual functions if
+ * devices start supporting PCIe w/ARI. However at the moment I
+ * do not know of any devices that support this so I do not reserve
+ * space for this at this time. If a future patch consumes the next
+ * byte it should be aware of this possiblity.
+ */
+#define ETHTOOL_RX_FLOW_SPEC_RING      0x00000000FFFFFFFFLL
+#define ETHTOOL_RX_FLOW_SPEC_RING_VF   0x000000FF00000000LL
+#define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
+static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
+{
+       return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
+};
+
+static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
+{
+       return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
+                               ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
+};
+
 /**
  * struct ethtool_rxnfc - command to get or set RX flow classification rules
  * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,