From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94B91C433FE for ; Tue, 19 Apr 2022 17:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355573AbiDSRHn (ORCPT ); Tue, 19 Apr 2022 13:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355710AbiDSRHI (ORCPT ); Tue, 19 Apr 2022 13:07:08 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513291583E; Tue, 19 Apr 2022 10:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650387824; x=1681923824; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=9qpy676qE+GQBGiNZy1vWDAhbXjYL7YBg7SD1FIiYLg=; b=jPJDFi10UNA5UTWPkD3v2gKiEZ3O+pYUHddOc0kAJ8V6AVOQ+HaUvFJo qiWr964+NT1dctnHmOCOXr139Edj9dKvsNHAudALmr7XspbRL+rQhMVCT gfNFUwIamXF/NqSbgWoXJmB7jFAZkp3yUJyOOxSCSc8vjuDcQrFvmP/r0 Lixc+7vC/dKgkxZu5Sind6Td16lAahKNCd2yRjbYfScin4BFT3g8x6inE iA4ov5DMu7Nl01InWzPOtGCyf6nY6tx5cWCn/ovo6cCOZkcj+spU9J7/S G2ImdHzkORx8uYS/CLyfYRQjHptV6xxrQPzxUrSupR9fwWc3DwrQdSnsY A==; X-IronPort-AV: E=McAfee;i="6400,9594,10322"; a="263279532" X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="263279532" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 10:03:43 -0700 X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="576190835" Received: from magillis-mobl.amr.corp.intel.com (HELO vcostago-mobl3) ([10.255.229.182]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 10:03:43 -0700 From: Vinicius Costa Gomes To: Jeff Evanson , Jeff Evanson , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , "intel-wired-lan@lists.osuosl.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: "jeff.evanson@gmail.com" Subject: RE: [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup In-Reply-To: References: <20220415210546.11294-1-jeff.evanson@qsc.com> <87v8v6477g.fsf@intel.com> Date: Tue, 19 Apr 2022 10:03:43 -0700 Message-ID: <87v8v5t380.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeff, Jeff Evanson writes: > Hi Vinicius. Thank you for the reply. > > The scenario only happens when the transmit queue interrupt is mapped > to a different interrupt from the receive queue. In the case where > XDP_WAKEUP_TX is set in the flags argument, the previous code would > only trigger the interrupt for the receive queue, causing the transmit > queue's napi_struct to never be scheduled. This is a good explanation, adding it to the commit message for the v2 would be a good idea. > > In the scenario where XDP_WAKEUP_TX and XDP_WAKEUP_RX are both set in > flags, the receive interrupt is always triggered and the transmit > interrupt is only triggered when the transmit q_vector differs from > the receive q_vector. I missed that condition when I looked at the patch. Sorry about that. Makes more sense now. Acked-by: Vinicius Costa Gomes > > Regards, > Jeff Evanson > > -----Original Message----- > From: Vinicius Costa Gomes > Sent: Monday, April 18, 2022 11:45 AM > To: Jeff Evanson ; Jesse Brandeburg ; Tony Nguyen ; David S. Miller ; Jakub Kicinski ; intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org > Cc: Jeff Evanson ; jeff.evanson@gmail.com > Subject: Re: [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup > > -External- > > Jeff Evanson writes: > >> in igc_xsk_wakeup, trigger the proper interrupt based on whether flags >> contains XDP_WAKEUP_RX and/or XDP_WAKEUP_TX >> >> Signed-off-by: Jeff Evanson >> --- >> drivers/net/ethernet/intel/igc/igc_main.c | 36 >> +++++++++++++++++------ >> 1 file changed, 27 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c >> b/drivers/net/ethernet/intel/igc/igc_main.c >> index a36a18c84aeb..d706de95dc06 100644 >> --- a/drivers/net/ethernet/intel/igc/igc_main.c >> +++ b/drivers/net/ethernet/intel/igc/igc_main.c >> @@ -6073,7 +6073,7 @@ static void igc_trigger_rxtxq_interrupt(struct >> igc_adapter *adapter, int igc_xsk_wakeup(struct net_device *dev, u32 >> queue_id, u32 flags) { >> struct igc_adapter *adapter = netdev_priv(dev); >> - struct igc_q_vector *q_vector; >> + struct igc_q_vector *txq_vector = 0, *rxq_vector = 0; >> struct igc_ring *ring; >> >> if (test_bit(__IGC_DOWN, &adapter->state)) @@ -6082,17 +6082,35 @@ >> int igc_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags) >> if (!igc_xdp_is_enabled(adapter)) >> return -ENXIO; >> >> - if (queue_id >= adapter->num_rx_queues) >> - return -EINVAL; >> + if (flags & XDP_WAKEUP_RX) { >> + if (queue_id >= adapter->num_rx_queues) >> + return -EINVAL; >> >> - ring = adapter->rx_ring[queue_id]; >> + ring = adapter->rx_ring[queue_id]; >> + if (!ring->xsk_pool) >> + return -ENXIO; >> >> - if (!ring->xsk_pool) >> - return -ENXIO; >> + rxq_vector = ring->q_vector; >> + } >> + >> + if (flags & XDP_WAKEUP_TX) { >> + if (queue_id >= adapter->num_tx_queues) >> + return -EINVAL; >> + >> + ring = adapter->tx_ring[queue_id]; >> + if (!ring->xsk_pool) >> + return -ENXIO; >> + >> + txq_vector = ring->q_vector; >> + } >> + >> + if (rxq_vector && >> + !napi_if_scheduled_mark_missed(&rxq_vector->napi)) >> + igc_trigger_rxtxq_interrupt(adapter, rxq_vector); >> >> - q_vector = adapter->q_vector[queue_id]; >> - if (!napi_if_scheduled_mark_missed(&q_vector->napi)) >> - igc_trigger_rxtxq_interrupt(adapter, q_vector); >> + if (txq_vector && txq_vector != rxq_vector && >> + !napi_if_scheduled_mark_missed(&txq_vector->napi)) >> + igc_trigger_rxtxq_interrupt(adapter, txq_vector); > > Two things: > - My imagination was not able to produce a scenario where this commit would solve any problems. Can you explain better the case where the current code would cause the wrong interrupt to be generated (or miss generating an interrupt)? (this should be in the commit message) > - I think that with this patch applied, there would cases (both TX and RX flags set) that we cause two writes into the EICS register. That could cause unnecessary wakeups. > >> >> return 0; >> } >> -- >> 2.17.1 >> > > Cheers, > -- > Vinicius > -- Vinicius From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinicius Costa Gomes Date: Tue, 19 Apr 2022 10:03:43 -0700 Subject: [Intel-wired-lan] [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup In-Reply-To: References: <20220415210546.11294-1-jeff.evanson@qsc.com> <87v8v6477g.fsf@intel.com> Message-ID: <87v8v5t380.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: Hi Jeff, Jeff Evanson writes: > Hi Vinicius. Thank you for the reply. > > The scenario only happens when the transmit queue interrupt is mapped > to a different interrupt from the receive queue. In the case where > XDP_WAKEUP_TX is set in the flags argument, the previous code would > only trigger the interrupt for the receive queue, causing the transmit > queue's napi_struct to never be scheduled. This is a good explanation, adding it to the commit message for the v2 would be a good idea. > > In the scenario where XDP_WAKEUP_TX and XDP_WAKEUP_RX are both set in > flags, the receive interrupt is always triggered and the transmit > interrupt is only triggered when the transmit q_vector differs from > the receive q_vector. I missed that condition when I looked at the patch. Sorry about that. Makes more sense now. Acked-by: Vinicius Costa Gomes > > Regards, > Jeff Evanson > > -----Original Message----- > From: Vinicius Costa Gomes > Sent: Monday, April 18, 2022 11:45 AM > To: Jeff Evanson ; Jesse Brandeburg ; Tony Nguyen ; David S. Miller ; Jakub Kicinski ; intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org; linux-kernel at vger.kernel.org > Cc: Jeff Evanson ; jeff.evanson at gmail.com > Subject: Re: [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup > > -External- > > Jeff Evanson writes: > >> in igc_xsk_wakeup, trigger the proper interrupt based on whether flags >> contains XDP_WAKEUP_RX and/or XDP_WAKEUP_TX >> >> Signed-off-by: Jeff Evanson >> --- >> drivers/net/ethernet/intel/igc/igc_main.c | 36 >> +++++++++++++++++------ >> 1 file changed, 27 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c >> b/drivers/net/ethernet/intel/igc/igc_main.c >> index a36a18c84aeb..d706de95dc06 100644 >> --- a/drivers/net/ethernet/intel/igc/igc_main.c >> +++ b/drivers/net/ethernet/intel/igc/igc_main.c >> @@ -6073,7 +6073,7 @@ static void igc_trigger_rxtxq_interrupt(struct >> igc_adapter *adapter, int igc_xsk_wakeup(struct net_device *dev, u32 >> queue_id, u32 flags) { >> struct igc_adapter *adapter = netdev_priv(dev); >> - struct igc_q_vector *q_vector; >> + struct igc_q_vector *txq_vector = 0, *rxq_vector = 0; >> struct igc_ring *ring; >> >> if (test_bit(__IGC_DOWN, &adapter->state)) @@ -6082,17 +6082,35 @@ >> int igc_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags) >> if (!igc_xdp_is_enabled(adapter)) >> return -ENXIO; >> >> - if (queue_id >= adapter->num_rx_queues) >> - return -EINVAL; >> + if (flags & XDP_WAKEUP_RX) { >> + if (queue_id >= adapter->num_rx_queues) >> + return -EINVAL; >> >> - ring = adapter->rx_ring[queue_id]; >> + ring = adapter->rx_ring[queue_id]; >> + if (!ring->xsk_pool) >> + return -ENXIO; >> >> - if (!ring->xsk_pool) >> - return -ENXIO; >> + rxq_vector = ring->q_vector; >> + } >> + >> + if (flags & XDP_WAKEUP_TX) { >> + if (queue_id >= adapter->num_tx_queues) >> + return -EINVAL; >> + >> + ring = adapter->tx_ring[queue_id]; >> + if (!ring->xsk_pool) >> + return -ENXIO; >> + >> + txq_vector = ring->q_vector; >> + } >> + >> + if (rxq_vector && >> + !napi_if_scheduled_mark_missed(&rxq_vector->napi)) >> + igc_trigger_rxtxq_interrupt(adapter, rxq_vector); >> >> - q_vector = adapter->q_vector[queue_id]; >> - if (!napi_if_scheduled_mark_missed(&q_vector->napi)) >> - igc_trigger_rxtxq_interrupt(adapter, q_vector); >> + if (txq_vector && txq_vector != rxq_vector && >> + !napi_if_scheduled_mark_missed(&txq_vector->napi)) >> + igc_trigger_rxtxq_interrupt(adapter, txq_vector); > > Two things: > - My imagination was not able to produce a scenario where this commit would solve any problems. Can you explain better the case where the current code would cause the wrong interrupt to be generated (or miss generating an interrupt)? (this should be in the commit message) > - I think that with this patch applied, there would cases (both TX and RX flags set) that we cause two writes into the EICS register. That could cause unnecessary wakeups. > >> >> return 0; >> } >> -- >> 2.17.1 >> > > Cheers, > -- > Vinicius > -- Vinicius