diff mbox series

[jkirsher/next-queue,3/5] ixgbe: Fix handling of macvlan Tx offload

Message ID 20171102233351.15146.16006.stgit@localhost.localdomain
State Changes Requested
Headers show
Series macvlan offload fixes | expand

Commit Message

Alexander Duyck Nov. 2, 2017, 11:34 p.m. UTC
From: Alexander Duyck <alexander.h.duyck@intel.com>

This update makes it so that we report the actual number of Tx queues via
real_num_tx_queues but are still restricted to RSS on only the first pool
by setting num_tc equal to 1. Doing this locks us into only having the
ability to setup XPS on the queues in that pool, and only those queues
should be used for transmitting anything other than macvlan traffic.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Comments

Shannon Nelson Nov. 3, 2017, 4:30 p.m. UTC | #1
On 11/2/2017 4:34 PM, Alexander Duyck wrote:
> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> This update makes it so that we report the actual number of Tx queues via
> real_num_tx_queues but are still restricted to RSS on only the first pool
> by setting num_tc equal to 1. Doing this locks us into only having the
> ability to setup XPS on the queues in that pool, and only those queues
> should be used for transmitting anything other than macvlan traffic.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>   drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 69ef35d13c36..b22ec4b9d02c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6638,8 +6638,9 @@ int ixgbe_open(struct net_device *netdev)
>   		goto err_req_irq;
>   
>   	/* Notify the stack of the actual queue counts. */
> -	if (adapter->num_rx_pools > 1)
> -		queues = adapter->num_rx_queues_per_pool;
> +	if (adapter->num_rx_pools > 1 &&
> +	    adapter->num_tx_queues > IXGBE_MAX_L2A_QUEUES)
> +		queues = IXGBE_MAX_L2A_QUEUES;
>   	else
>   		queues = adapter->num_tx_queues;
>   
> @@ -8901,6 +8902,18 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
>   		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
>   			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
>   
> +		/* To support macvlan offload we have to use num_tc to
> +		 * restrict the queues that can be used by the device.
> +		 * By doing this we can avoid reporing a false number of

s/reporing/reporting/

> +		 * queues.
> +		 */
> +		if (adapter->num_rx_pools > 1) {
> +			u16 qpp = adapter->num_rx_queues_per_pool;
> +
> +			netdev_set_num_tc(dev, 1);
> +			netdev_set_tc_queue(dev, 0, qpp, 0);
> +		}
> +
>   		adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
>   
>   		adapter->temp_dcb_cfg.pfc_mode_enable = false;
> 
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
>
Alexander Duyck Nov. 3, 2017, 6:18 p.m. UTC | #2
On Thu, Nov 2, 2017 at 4:34 PM, Alexander Duyck
<alexander.duyck@gmail.com> wrote:
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> This update makes it so that we report the actual number of Tx queues via
> real_num_tx_queues but are still restricted to RSS on only the first pool
> by setting num_tc equal to 1. Doing this locks us into only having the
> ability to setup XPS on the queues in that pool, and only those queues
> should be used for transmitting anything other than macvlan traffic.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 69ef35d13c36..b22ec4b9d02c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6638,8 +6638,9 @@ int ixgbe_open(struct net_device *netdev)
>                 goto err_req_irq;
>
>         /* Notify the stack of the actual queue counts. */
> -       if (adapter->num_rx_pools > 1)
> -               queues = adapter->num_rx_queues_per_pool;
> +       if (adapter->num_rx_pools > 1 &&
> +           adapter->num_tx_queues > IXGBE_MAX_L2A_QUEUES)
> +               queues = IXGBE_MAX_L2A_QUEUES;
>         else
>                 queues = adapter->num_tx_queues;
>

I'm going to need to redo this portion of the patch anyway. It turns
out I was only enabling up to 4 queues (which worked for my test case
with 2 macvlan interfaces) because I didn't quite grok what this was
doing.

> @@ -8901,6 +8902,18 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
>                 if (adapter->hw.mac.type == ixgbe_mac_82598EB)
>                         adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
>
> +               /* To support macvlan offload we have to use num_tc to
> +                * restrict the queues that can be used by the device.
> +                * By doing this we can avoid reporing a false number of
> +                * queues.
> +                */
> +               if (adapter->num_rx_pools > 1) {
> +                       u16 qpp = adapter->num_rx_queues_per_pool;
> +
> +                       netdev_set_num_tc(dev, 1);
> +                       netdev_set_tc_queue(dev, 0, qpp, 0);
> +               }
> +
>                 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
>
>                 adapter->temp_dcb_cfg.pfc_mode_enable = false;
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 69ef35d13c36..b22ec4b9d02c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6638,8 +6638,9 @@  int ixgbe_open(struct net_device *netdev)
 		goto err_req_irq;
 
 	/* Notify the stack of the actual queue counts. */
-	if (adapter->num_rx_pools > 1)
-		queues = adapter->num_rx_queues_per_pool;
+	if (adapter->num_rx_pools > 1 &&
+	    adapter->num_tx_queues > IXGBE_MAX_L2A_QUEUES)
+		queues = IXGBE_MAX_L2A_QUEUES;
 	else
 		queues = adapter->num_tx_queues;
 
@@ -8901,6 +8902,18 @@  int ixgbe_setup_tc(struct net_device *dev, u8 tc)
 		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
 			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
 
+		/* To support macvlan offload we have to use num_tc to
+		 * restrict the queues that can be used by the device.
+		 * By doing this we can avoid reporing a false number of
+		 * queues.
+		 */
+		if (adapter->num_rx_pools > 1) {
+			u16 qpp = adapter->num_rx_queues_per_pool;
+
+			netdev_set_num_tc(dev, 1);
+			netdev_set_tc_queue(dev, 0, qpp, 0);
+		}
+
 		adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
 
 		adapter->temp_dcb_cfg.pfc_mode_enable = false;