From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mail.toke.dk (Postfix) with ESMTPS id 01D76AF7C4D for ; Thu, 06 Feb 2025 20:23: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=Eif1weWK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738869820; x=1770405820; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=wJGI2bLXyHmfSwJy/rb+BsVOcR9LZItNYcLw9ytE4cM=; b=Eif1weWK3XCRZOOymtuYZvvOD1phCfSontIXHO8xKK8IMAp3ekLv41ha FjBnF0jJafg4BHJXPvMmJP+UJPcoMB9SIU5LFiYc3APgmdd9MubJej+NK lPVkMbqzR6wlWOGMw3+wYMfVmQVOou/tnoM9ejrHEupzTGnWMRlIZdaT9 NCZO3WsoUiCR4gOUjia6Ae72e8aX6V6qc4YdCWDKo0kBBKC6Gp4EYqao2 I29/7AnRiM8vVijZ8uzGGHk61JfgxqD7PHJNbQucLrdthzF5PpwD3r3Li yzFvVMWTHhikFx7PyL5uPoIBAR7x9nQsRIVPJYvH8phmI46QOljsFkbNr A==; X-CSE-ConnectionGUID: cbXfeWc0RySNsb35A59Z6Q== X-CSE-MsgGUID: b/nSTpb+Q8iwqKm6dzLwyg== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27100960" X-IronPort-AV: E=Sophos;i="6.13,265,1732608000"; d="scan'208";a="27100960" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2025 11:23:38 -0800 X-CSE-ConnectionGUID: tsCISfg9QIiO4rrWuF0NcQ== X-CSE-MsgGUID: BG2SBAMPSnu6yvO0K+BNhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="116244381" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Feb 2025 11:23:37 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Thu, 6 Feb 2025 11:23:37 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Thu, 6 Feb 2025 11:23:37 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.48) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Thu, 6 Feb 2025 11:23:34 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A1oFq3H5oILOI+HhxqBPuIxrG5aeIuqjt5jCas4BsIh6+lz/ffbeXE81qoBDHh3uy2OMuJOdM4Fx6711zFIdL5C18UqHm1r31cgy0yckV/peT5BuldKEEXSmoyA8f9pySz9iIZPKBE2N1zIXDADHCC5mRlEByaA71wSjLpJHMAvpy+tZEkZNS3jbgQ53D7dlb5uFD8IFHTaCnSAD50+GL8TCV/YQrIgtV0DpInO+5XNHW1j2UXSn4tYmSZkoKKhFUX63fa4jdjHeJaxslKcnGfmNShC5LM797yoV/U6lP5RIHMqZe+ZdFJvtixxChTOFKJBpTeOKQ19X4BFYjxEf4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YGocix4Dy3akd96wfOPbWvVNDRO0QUOOkAtI2xPbqC4=; b=WzJYk+RKt0T4L2CX5wd2FujPip9Xuj3QEpo5ajQCJRGNXhBaEuvr0L1NdVoivc0U/WsSXbCQ+I3B9qBVFfgGpHfZ1Axmwl/Cy+kgqI+/Bc/5xBxvvYMDZgLw3jcKI2DoxZFws3w7pOkF4A4pbOmmWo5Iv/U/BNIen91YiQ+bA1G00fBPvTtKE/Q81390YPOi5UhZSnn/c9aFRCFM/3xVm22R1iWMUL9Dx8UU2bMficfUrv4wFZXNSf9HDwtnko7R9oiHyZelu0oGy7N4o0ANcgZMmNgsCpKmfdrKAJpEIdTrtLi+vH+t2AMokfp5SMxRxGhZDyOz97lo17j53OS+2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA1PR11MB6097.namprd11.prod.outlook.com (2603:10b6:208:3d7::17) by CY8PR11MB7081.namprd11.prod.outlook.com (2603:10b6:930:53::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.12; Thu, 6 Feb 2025 19:23:29 +0000 Received: from IA1PR11MB6097.namprd11.prod.outlook.com ([fe80::8f29:c6c9:9eb2:6392]) by IA1PR11MB6097.namprd11.prod.outlook.com ([fe80::8f29:c6c9:9eb2:6392%4]) with mapi id 15.20.8398.025; Thu, 6 Feb 2025 19:23:28 +0000 Date: Thu, 6 Feb 2025 20:23:11 +0100 From: Maciej Fijalkowski To: Song Yoong Siang Message-ID: References: <20250206060408.808325-1-yoong.siang.song@intel.com> <20250206060408.808325-5-yoong.siang.song@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20250206060408.808325-5-yoong.siang.song@intel.com> X-ClientProxiedBy: MI0P293CA0012.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:44::20) To IA1PR11MB6097.namprd11.prod.outlook.com (2603:10b6:208:3d7::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB6097:EE_|CY8PR11MB7081:EE_ X-MS-Office365-Filtering-Correlation-Id: f44d95cd-ea1b-4ace-0049-08dd46e3bc3d X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?67lYSvcVo/LcU4J50QMQzOEOnpLscll2Kn9O376775jhs0pJvvoq97wI1TXC?= =?us-ascii?Q?Nmc9nu7z9McWP95dUV9Yzs5pzUC3rC90aDuJEr4rZRt9MqdlBEXnr4PFZIH5?= =?us-ascii?Q?WIUunn3cMEciQ4wvqb4NDce6vr21z1mKQh+U+rYKJ50+9aMWXo0l3szgkdXh?= =?us-ascii?Q?JCaXLROCfXGOQNE1Zz7huo9Rq/CCqRrhTuLRuta1bhS71IxSgW1d099NkXVV?= =?us-ascii?Q?ld/0B+RAoQhCLuF60EyOtZVylbfivyB9FPOOhTF9/0bzDYrt7jNhqo2mIKGV?= =?us-ascii?Q?8MXZabQDhUZt9+98nRIZzdFZ05Fufc3V7KnkOgF96ZMNBX2tpmh/0YQ1LFoU?= =?us-ascii?Q?f1VFCD9r/4+7WogxL6GDIdj3R0UlKZwryDtmHlIIxBq9fMIRm6XDxQbJpMwi?= =?us-ascii?Q?LC6nD209ZFFWzDDaebujRjbBmif4gRNlDQAVns/yieedmBTbn1Y/3lZv/m3q?= =?us-ascii?Q?G/N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k5gn?= =?us-ascii?Q?+CJoKjDqXpsVRXESghM5q5g4OZT/?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB6097.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0/eUakziOMjt4rUAk7d7qTa576LjHVPrX2ECZikm9NYAS1XFI4yAzmzEZue/?= =?us-ascii?Q?0AZwguJP3/+8gAi0vUf+bNKnnRCoLlLrRyUbv1dmr+7Ek2UtYJ2zzwwvNygM?= =?us-ascii?Q?oLd4gpyzlC0d1AUmib7WLuIB3J+Sm3HLnsuQ/XMAJbJMmQRsD3cCZoWyfrtI?= =?us-ascii?Q?BLF1Kyrqn2xDPiQKPykNt9k6pOGO9P+T09bVrmXLO+cQh/RCvgfHBdLTDRRE?= =?us-ascii?Q?jXqRJLr5HO9Xk/4i9BVcQ/jVPTrmlFq7BsVVEIZ0FMtS8L2DDEWmViNpRjFG?= =?us-ascii?Q?Lzvo9wqBR5fmlbkHkYfJuE+2uWA1oc3OcaigeH4/hm+EJj4xtSJfOBBdDnvr?= =?us-ascii?Q?r9qZyEHigUVVv22juXVUFuMERGJPiCIWzsFNqFamUdzGegC0GF6SpvG2H3bh?= =?us-ascii?Q?angFOBhw2B/VX74l07Ps0jm8U3A0aQsB3c6RPR9Q2lYt02i9CTaT1v9dIZp+?= =?us-ascii?Q?CpHSB6kgoLMqFWq5PWe/+Cj1w8tv+FmNH0B7BRnrXBjzVLr77kdFZB6G9ugV?= =?us-ascii?Q?JNeetj191yy3vr70sVX9fFM7PLtNbZ2smF8ohbb/a66s35B8l52bYzcS54tK?= =?us-ascii?Q?VSANdNdkclS6JXb/9DekBDzxwW+OmJqC8dDF2H0kjCpF2cTFzZM6B6DS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gCWq8mJOQB9o7C6X1eUjJJLEILqlFT1cCd?= =?us-ascii?Q?OaZ6LpJZGR2ci/ZqdHeaIZpVg3i9nil3MUJ/9tIomGizszQpWVgnj90PoeKs?= =?us-ascii?Q?bQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f44d95cd-ea1b-4ace-0049-08dd46e3bc3d X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB6097.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2025 19:23:28.8335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o/U56XOn53Mf28yb5L+v3REzx+lbcCIlkRVXfZk54ANpTbmHfHa3vDtGwizmvWbmbMVO1nMXAs6B64NWhqIqtM07PMWLycMeHSqyfQc+SpY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7081 X-OriginatorOrg: intel.com X-MailFrom: maciej.fijalkowski@intel.com X-Mailman-Rule-Hits: implicit-dest X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header Message-ID-Hash: TWTTSMFWPY5FFFAHUE4V5OALQ3WKC4H6 X-Message-ID-Hash: TWTTSMFWPY5FFFAHUE4V5OALQ3WKC4H6 X-Mailman-Approved-At: Fri, 07 Feb 2025 09:29:33 +0100 CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , Florian Bezdeka , Donald Hunter , Jonathan Corbet , Bjorn Topel , Magnus Karlsson , 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 , Faizal Rahim , Choong Yong Liang , Bouska Zdenek , 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 v9 4/5] igc: Refactor empty frame insertion for launch time support List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Feb 06, 2025 at 02:04:07PM +0800, Song Yoong Siang wrote: > Refactor the code for inserting an empty frame into a new function > igc_insert_empty_frame(). 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. > > Remove the igc_desc_unused() checking in igc_init_tx_empty_descriptor() > because the number of descriptors needed is guaranteed. > > Ensure that skb allocation and DMA mapping work for the empty frame, > before proceeding to fill in igc_tx_buffer info, context descriptor, > and data descriptor. > > Rate limit the error messages for skb allocation and DMA mapping failures. > > Update the comment to indicate that the 2 descriptors needed by the empty > frame are already taken into consideration in igc_xmit_frame_ring(). > > Handle the case where the insertion of an empty frame fails and explain > the reason behind this handling. > > Signed-off-by: Song Yoong Siang Reviewed-by: Maciej Fijalkowski with one nit below. > --- > drivers/net/ethernet/intel/igc/igc_main.c | 84 ++++++++++++++--------- > 1 file changed, 52 insertions(+), 32 deletions(-) > > diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c > index 84307bb7313e..3df608601a4b 100644 > --- a/drivers/net/ethernet/intel/igc/igc_main.c > +++ b/drivers/net/ethernet/intel/igc/igc_main.c > @@ -1092,7 +1092,9 @@ static int igc_init_empty_frame(struct igc_ring *ring, > > dma = dma_map_single(ring->dev, skb->data, size, DMA_TO_DEVICE); > if (dma_mapping_error(ring->dev, dma)) { > - netdev_err_once(ring->netdev, "Failed to map DMA for TX\n"); > + if (net_ratelimit()) > + netdev_err(ring->netdev, > + "DMA mapping error for empty frame\n"); This is open-coded net_err_ratelimited(), no? > return -ENOMEM; > } > > @@ -1108,20 +1110,12 @@ static int igc_init_empty_frame(struct igc_ring *ring, > return 0; > } > > -static int igc_init_tx_empty_descriptor(struct igc_ring *ring, > - struct sk_buff *skb, > - struct igc_tx_buffer *first) > +static void igc_init_tx_empty_descriptor(struct igc_ring *ring, > + struct sk_buff *skb, > + struct igc_tx_buffer *first) > { > union igc_adv_tx_desc *desc; > u32 cmd_type, olinfo_status; > - int err; > - > - if (!igc_desc_unused(ring)) > - return -EBUSY; > - > - err = igc_init_empty_frame(ring, first, skb); > - if (err) > - return err; > > cmd_type = IGC_ADVTXD_DTYP_DATA | IGC_ADVTXD_DCMD_DEXT | > IGC_ADVTXD_DCMD_IFCS | IGC_TXD_DCMD | > @@ -1140,8 +1134,6 @@ static int igc_init_tx_empty_descriptor(struct igc_ring *ring, > ring->next_to_use++; > if (ring->next_to_use == ring->count) > ring->next_to_use = 0; > - > - return 0; > } > > #define IGC_EMPTY_FRAME_SIZE 60 > @@ -1567,6 +1559,41 @@ static bool igc_request_tx_tstamp(struct igc_adapter *adapter, struct sk_buff *s > return false; > } > > +static int igc_insert_empty_frame(struct igc_ring *tx_ring) > +{ > + struct igc_tx_buffer *empty_info; > + struct sk_buff *empty_skb; > + void *data; > + int ret; > + > + empty_info = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; > + empty_skb = alloc_skb(IGC_EMPTY_FRAME_SIZE, GFP_ATOMIC); > + if (unlikely(!empty_skb)) { > + if (net_ratelimit()) > + netdev_err(tx_ring->netdev, > + "skb alloc error for empty frame\n"); ditto > + return -ENOMEM; > + } > + > + data = skb_put(empty_skb, IGC_EMPTY_FRAME_SIZE); > + memset(data, 0, IGC_EMPTY_FRAME_SIZE); > + > + /* Prepare DMA mapping and Tx buffer information */ > + ret = igc_init_empty_frame(tx_ring, empty_info, empty_skb); > + if (unlikely(ret)) { > + dev_kfree_skb_any(empty_skb); > + return ret; > + } > + > + /* Prepare advanced context descriptor for empty packet */ > + igc_tx_ctxtdesc(tx_ring, 0, false, 0, 0, 0); > + > + /* Prepare advanced data descriptor for empty packet */ > + igc_init_tx_empty_descriptor(tx_ring, empty_skb, empty_info); > + > + return 0; > +} > + > static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, > struct igc_ring *tx_ring) > { > @@ -1586,6 +1613,7 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, > * + 1 desc for skb_headlen/IGC_MAX_DATA_PER_TXD, > * + 2 desc gap to keep tail from touching head, > * + 1 desc for context descriptor, > + * + 2 desc for inserting an empty packet for launch time, > * otherwise try next time > */ > for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) > @@ -1605,24 +1633,16 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb, > 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); > + /* Reset the launch time if the required empty frame fails to > + * be inserted. However, this packet is not dropped, so it > + * "dirties" the current Qbv cycle. This ensures that the > + * upcoming packet, which is scheduled in the next Qbv cycle, > + * does not require an empty frame. This way, the launch time > + * continues to function correctly despite the current failure > + * to insert the empty frame. > + */ > + if (igc_insert_empty_frame(tx_ring)) > + launch_time = 0; > } > > done: > -- > 2.34.1 >