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 04E60C433EF for ; Mon, 18 Apr 2022 17:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347202AbiDRRrg (ORCPT ); Mon, 18 Apr 2022 13:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241488AbiDRRr3 (ORCPT ); Mon, 18 Apr 2022 13:47:29 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4BF2DEC; Mon, 18 Apr 2022 10:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650303889; x=1681839889; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=D/Flz0ZSVs+oASuVLiQaVr825MaM3PoEU2QzN/vdta4=; b=gQ2i8eaLnvKMxOJrupKvZyeA458NpJICiXlhs16y0XvgygpiS/zxcdTN xaKfmVrmcxnkkenoFEWJUgJXztXQuHR2y7mLVyOBqDBMw0vVBpgp34z2Z aDzUEeqGnDWTcAns4VaKyVFQXkMG9+WeVpkbMgckFwYt1PfsOmfv+PDuL YMBbTAP+6lhjnuDtXwLX+knJWQyHIUcqplANucAiAMvK9RrM1UMHqf7cN 42ESIs5uuG0rFshgonoazTmFZsqi3Ao92Jtc0f51I9GBlcnX9GILnDLyd vhwidiSpMAQ62bjqMrA9PYZa7RMTxohrD5gb72pKCQIX4e3oFRAWRyaak Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="288667288" X-IronPort-AV: E=Sophos;i="5.90,270,1643702400"; d="scan'208";a="288667288" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 10:44:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,270,1643702400"; d="scan'208";a="804372037" Received: from alanadu-mobl2.amr.corp.intel.com (HELO vcostago-mobl3) ([10.251.2.172]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 10:44:36 -0700 From: Vinicius Costa Gomes 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@qsc.com, jeff.evanson@gmail.com Subject: Re: [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup In-Reply-To: <20220415210546.11294-1-jeff.evanson@qsc.com> References: <20220415210546.11294-1-jeff.evanson@qsc.com> Date: Mon, 18 Apr 2022 13:44:35 -0400 Message-ID: <87v8v6477g.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinicius Costa Gomes Date: Mon, 18 Apr 2022 13:44:35 -0400 Subject: [Intel-wired-lan] [PATCH 2/2] Trigger proper interrupts in igc_xsk_wakeup In-Reply-To: <20220415210546.11294-1-jeff.evanson@qsc.com> References: <20220415210546.11294-1-jeff.evanson@qsc.com> Message-ID: <87v8v6477g.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: 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