Subject: Re: [PATCH net-next v3] net/mlx5e: link NAPI instances to queues and IRQs

From: Rahul Rameshbabu <[email-masked]>
Date: Fri, 09 Feb 2024 11:26:33 -0800

On Fri, 09 Feb, 2024 11:24:04 -0800 Joe Damato <[email-masked]> wrote:
> On Thu, Feb 08, 2024 at 08:43:57PM -0800, Rahul Rameshbabu wrote:
>> On Thu, 08 Feb, 2024 21:13:25 +0200 Tariq Toukan <[email-masked]> wrote:
>> > On 08/02/2024 5:07, Joe Damato wrote:
>> >> Make mlx5 compatible with the newly added netlink queue GET APIs.
>> >> Signed-off-by: Joe Damato <[email-masked]>
>> >> ---
>> 
>> Just came back from testing this code. Let me make one cosmetic point
>> here. I noticed this patch has a line that is past 90 characters. Would
>> be nice to get it wrapped in the next version. We use 90 instead of 80
>> characters for the line wrap in the mlx5 driver because of firmware
>> command interface related code would lead to very hard to read lines if
>> wrapped at 80.
>> 
>>   https://patchwork.kernel.org/project/netdevbpf/patch/[email-masked]/
>
> OK, I had wrapped them in the next version I was going to send to 80, but
> I'll adjust that to 90.
>
>> >> v2 -> v3:
>> >>    - Fix commit message subject
>> >>    - call netif_queue_set_napi in mlx5e_ptp_activate_channel and
>> >>      mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for
>> >>      the PTP channel.
>> >>    - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set
>> >>      NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including
>> >>      QoS/HTB and PTP.
>> >>    - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for
>> >>      better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI
>> >>      structs
>> >> v1 -> v2:
>> >>    - Move netlink NULL code to mlx5e_deactivate_channel
>> >>    - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the
>> >>      irq, after netif_napi_add which itself sets the IRQ to -1
>> >>   drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c  | 3 +++
>> >>   drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++
>> >>   2 files changed, 10 insertions(+)
>> >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
>> >> b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
>> >> index 078f56a3cbb2..fbbc287d924d 100644
>> >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
>> >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
>> >> @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
>> >>   	int tc;
>> >>     	napi_enable(&c->napi);
>> >> +	netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX,
>> >> +			     &c->napi);
>> 
>> This should only be set if MLX5E_PTP_STATE_RX is set. Otherwise, the rq
>> is not initialized. The following callgraph should help illustrate this.
>> 
>>    mlx5e_ptp_open
>>     |_ mlx5e_ptp_open_queues
>>        |_ mlx5e_ptp_open_rq
>>           |_ mlx5e_open_rq
>
> I had made the change that Tariq had suggested in the previous message of
> using sq->netdev and sq->cq.napi, but I can also tie that into
> MLX5E_PTP_STATE_RX.

Right, Tariq's comments are needed for the TX queue associations and are
needed as well. We also need to make sure we do not create an RX queue
association for an RX queue that may not exist for this special PTP
channel.

>
> I'll add this change as well, test locally again and resend shortly.
>

--
Thanks,

Rahul Rameshbabu