From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mail.toke.dk (Postfix) with ESMTPS id 3908DAF6ED3 for ; Tue, 04 Feb 2025 03:42:39 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=CLbPzUJL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738636960; x=1770172960; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=192aj1QJsPyGtAMkRPhiiiupVd6SXNH3StPpurpmAIo=; b=CLbPzUJLzezdSy1F655VrO90pyY7YgkG9onE5sn56oK4RQl7QH04e34G lJU1lnoWN3dl4bZ6Akrbm31ke2mRkFXVJCH9naDsJWjdDMhCV7NKWtdV8 W/sLuBp6YWaUtWo0pZlxXxhv7+wMKQLHeXKdTLVVBeoj88UmA1KNuDl8a vtkRd9+wfkmZiGBb/c7clpAby2I46U4agbt2jlibJI/CXhJezkV4NwGn0 AKu2RgLLvra2WzjLpQZM6YmqOAYdpVphgXHjCGGsknl+cME/qzYUY0UOl wqHMKq8MNbbesZYQ8e9ssAEnmCQJht1z0QdHtZCfWcst9VQVbra1Wak3X A==; X-CSE-ConnectionGUID: MXTUN17yQ76DA0Bbwr76qA== X-CSE-MsgGUID: Iwyj6+L1QsSGWjFRathr8A== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50564141" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50564141" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 18:42:37 -0800 X-CSE-ConnectionGUID: k5pMJs/eS1KFJUS51BcEEw== X-CSE-MsgGUID: LsDoyXyXTwW06yE4uEzP3A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,257,1732608000"; d="scan'208";a="111051867" Received: from mohdfai2-mobl.gar.corp.intel.com (HELO [10.247.89.75]) ([10.247.89.75]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 18:42:26 -0800 Message-ID: Date: Tue, 4 Feb 2025 10:42:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Song Yoong Siang , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , Florian Bezdeka , Donald Hunter , Jonathan Corbet , Bjorn Topel , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Andrew Lunn , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Joe Damato , Stanislav Fomichev , Xuan Zhuo , Mina Almasry , Daniel Jurgens , Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Hao Luo , Jiri Olsa , Shuah Khan , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Tony Nguyen , Przemek Kitszel , Choong Yong Liang , Bouska Zdenek References: <20250204004907.789330-1-yoong.siang.song@intel.com> <20250204004907.789330-5-yoong.siang.song@intel.com> Content-Language: en-US From: "Abdul Rahim, Faizal" In-Reply-To: <20250204004907.789330-5-yoong.siang.song@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: ER2QYPKR25X3PDMY22YNS4FTJRJ7XPSL X-Message-ID-Hash: ER2QYPKR25X3PDMY22YNS4FTJRJ7XPSL X-MailFrom: faizal.abdul.rahim@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, intel-wired-lan@lists.osuosl.org, xdp-hints@xdp-project.net X-Mailman-Version: 3.3.10 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v7 4/5] igc: Refactor empty packet insertion into a reusable function List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 4/2/2025 8:49 am, Song Yoong Siang wrote: > Refactor the code for inserting an empty packet into a new function > igc_insert_empty_packet(). This change extracts the logic for inserting > an empty packet from igc_xmit_frame_ring() into a separate function, > allowing it to be reused in future implementations, such as the XDP > zero copy transmit function. > > This patch introduces no functional changes. > > Signed-off-by: Song Yoong Siang > --- > drivers/net/ethernet/intel/igc/igc_main.c | 42 ++++++++++++----------- > 1 file changed, 22 insertions(+), 20 deletions(-) > > diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c > index 56a35d58e7a6..c3edd8bcf633 100644 > --- a/drivers/net/ethernet/intel/igc/igc_main.c > +++ b/drivers/net/ethernet/intel/igc/igc_main.c > @@ -1566,6 +1566,26 @@ static bool igc_request_tx_tstamp(struct igc_adapter *adapter, struct sk_buff *s > return false; > } > > +static void igc_insert_empty_packet(struct igc_ring *tx_ring) > +{ > + struct igc_tx_buffer *empty_info; > + struct sk_buff *empty; > + void *data; > + > + empty_info = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; > + empty = alloc_skb(IGC_EMPTY_FRAME_SIZE, GFP_ATOMIC); > + if (!empty) > + return; > + > + data = skb_put(empty, IGC_EMPTY_FRAME_SIZE); > + memset(data, 0, IGC_EMPTY_FRAME_SIZE); > + > + igc_tx_ctxtdesc(tx_ring, 0, false, 0, 0, 0); > + > + if (igc_init_tx_empty_descriptor(tx_ring, empty, empty_info) < 0) > + dev_kfree_skb_any(empty); > +} > + > static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, > struct igc_ring *tx_ring) > { > @@ -1603,26 +1623,8 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, > skb->tstamp = ktime_set(0, 0); > launch_time = igc_tx_launchtime(tx_ring, txtime, &first_flag, &insert_empty); > > - if (insert_empty) { > - struct igc_tx_buffer *empty_info; > - struct sk_buff *empty; > - void *data; > - > - empty_info = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; > - empty = alloc_skb(IGC_EMPTY_FRAME_SIZE, GFP_ATOMIC); > - if (!empty) > - goto done; > - > - data = skb_put(empty, IGC_EMPTY_FRAME_SIZE); > - memset(data, 0, IGC_EMPTY_FRAME_SIZE); > - > - igc_tx_ctxtdesc(tx_ring, 0, false, 0, 0, 0); > - > - if (igc_init_tx_empty_descriptor(tx_ring, > - empty, > - empty_info) < 0) > - dev_kfree_skb_any(empty); > - } > + if (insert_empty) > + igc_insert_empty_packet(tx_ring); > > done: > /* record the location of the first descriptor for this packet */ Reviewed-by: Faizal Rahim