All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec
@ 2015-05-18 16:18 John Fastabend
  2015-05-18 16:19 ` [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space John Fastabend
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: John Fastabend @ 2015-05-18 16:18 UTC (permalink / raw)
  To: intel-wired-lan

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.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 include/uapi/linux/ethtool.h |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 2e49fc8..b5b4287 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -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	0x00000000FFFFFFFF
+#define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000
+#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,


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space
  2015-05-18 16:18 [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec John Fastabend
@ 2015-05-18 16:19 ` John Fastabend
  2015-05-22 23:34   ` Singh, Krishneil K
  2015-05-22 23:33 ` [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec Singh, Krishneil K
  2015-05-26 15:21 ` John Fastabend
  2 siblings, 1 reply; 5+ messages in thread
From: John Fastabend @ 2015-05-18 16:19 UTC (permalink / raw)
  To: intel-wired-lan

Flow director is exported to user space using the ethtool ntuple
support. However, currently it only supports steering traffic to a
subset of the queues in use by the hardware. This change allows
flow director to specify queues that have been assigned to virtual
functions by partitioning the ring_cookie into a 8bit vf specifier
followed by 32bit queue index. At the moment we don't have any
ethernet drivers with more than 2^32 queues on a single function
as best I can tell and nor do I expect this to happen anytime
soon. This way the ring_cookie's normal use for specifying a queue
on a specific PCI function continues to work as expected.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   34 ++++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index eafa9ec..057a7c5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2594,18 +2594,35 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 	struct ixgbe_hw *hw = &adapter->hw;
 	struct ixgbe_fdir_filter *input;
 	union ixgbe_atr_input mask;
+	u8 queue;
 	int err;
 
 	if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
 		return -EOPNOTSUPP;
 
-	/*
-	 * Don't allow programming if the action is a queue greater than
-	 * the number of online Rx queues.
+	/* ring_cookie is a masked into a set of queues and ixgbe pools or
+	 * we use the drop index.
 	 */
-	if ((fsp->ring_cookie != RX_CLS_FLOW_DISC) &&
-	    (fsp->ring_cookie >= adapter->num_rx_queues))
-		return -EINVAL;
+	if (fsp->ring_cookie == RX_CLS_FLOW_DISC) {
+		queue = IXGBE_FDIR_DROP_QUEUE;
+	} else {
+		u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie);
+		u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
+
+		if (!vf && (ring >= adapter->num_rx_queues))
+			return -EINVAL;
+		else if (vf &&
+			 ((vf > adapter->num_vfs) ||
+			   ring >= adapter->num_rx_queues_per_pool))
+			return -EINVAL;
+
+		/* Map the ring onto the absolute queue index */
+		if (!vf)
+			queue = adapter->rx_ring[ring]->reg_idx;
+		else
+			queue = ((vf - 1) *
+				adapter->num_rx_queues_per_pool) + ring;
+	}
 
 	/* Don't allow indexes to exist outside of available space */
 	if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) {
@@ -2683,10 +2700,7 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 
 	/* program filters to filter memory */
 	err = ixgbe_fdir_write_perfect_filter_82599(hw,
-				&input->filter, input->sw_idx,
-				(input->action == IXGBE_FDIR_DROP_QUEUE) ?
-				IXGBE_FDIR_DROP_QUEUE :
-				adapter->rx_ring[input->action]->reg_idx);
+				&input->filter, input->sw_idx, queue);
 	if (err)
 		goto err_out_w_lock;
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec
  2015-05-18 16:18 [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec John Fastabend
  2015-05-18 16:19 ` [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space John Fastabend
@ 2015-05-22 23:33 ` Singh, Krishneil K
  2015-05-26 15:21 ` John Fastabend
  2 siblings, 0 replies; 5+ messages in thread
From: Singh, Krishneil K @ 2015-05-22 23:33 UTC (permalink / raw)
  To: intel-wired-lan

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of John Fastabend
Sent: Monday, May 18, 2015 9:19 AM
To: alexander.h.duyck@redhat.com
Cc: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [net-next PATCH v4 1/2] 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.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 include/uapi/linux/ethtool.h |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 2e49fc8..b5b4287 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h

Tested-by:  Krishneil Singh <Krishneil.k.singh@intel.com>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space
  2015-05-18 16:19 ` [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space John Fastabend
@ 2015-05-22 23:34   ` Singh, Krishneil K
  0 siblings, 0 replies; 5+ messages in thread
From: Singh, Krishneil K @ 2015-05-22 23:34 UTC (permalink / raw)
  To: intel-wired-lan


-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of John Fastabend
Sent: Monday, May 18, 2015 9:20 AM
To: alexander.h.duyck@redhat.com
Cc: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space

Flow director is exported to user space using the ethtool ntuple support. However, currently it only supports steering traffic to a subset of the queues in use by the hardware. This change allows flow director to specify queues that have been assigned to virtual functions by partitioning the ring_cookie into a 8bit vf specifier followed by 32bit queue index. At the moment we don't have any ethernet drivers with more than 2^32 queues on a single function as best I can tell and nor do I expect this to happen anytime soon. This way the ring_cookie's normal use for specifying a queue on a specific PCI function continues to work as expected.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   34 ++++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index eafa9ec..057a7c5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Tested-by:  Krishneil Singh <Krishneil.k.singh@intel.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec
  2015-05-18 16:18 [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec John Fastabend
  2015-05-18 16:19 ` [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space John Fastabend
  2015-05-22 23:33 ` [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec Singh, Krishneil K
@ 2015-05-26 15:21 ` John Fastabend
  2 siblings, 0 replies; 5+ messages in thread
From: John Fastabend @ 2015-05-26 15:21 UTC (permalink / raw)
  To: intel-wired-lan

On 05/18/2015 09:18 AM, John Fastabend wrote:
> 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.
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ---
>   include/uapi/linux/ethtool.h |   25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 2e49fc8..b5b4287 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -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	0x00000000FFFFFFFF
> +#define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000

This needs an LL,

  +#define ETHTOOL_RX_FLOW_SPEC_RING	0x00000000FFFFFFFFLL
  +#define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000LL

so I guess I'll have to send a v5.

Thanks,
John


-- 
John Fastabend         Intel Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-26 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 16:18 [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec John Fastabend
2015-05-18 16:19 ` [Intel-wired-lan] [net-next PATCH v4 2/2] ixgbe: Allow flow director to use entire queue space John Fastabend
2015-05-22 23:34   ` Singh, Krishneil K
2015-05-22 23:33 ` [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec Singh, Krishneil K
2015-05-26 15:21 ` John Fastabend

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.