From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3DF3C43E83; Tue, 16 Apr 2024 17:38:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D963D402B5; Tue, 16 Apr 2024 17:38:50 +0200 (CEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id BD5EC40268 for ; Tue, 16 Apr 2024 17:38:49 +0200 (CEST) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5d3912c9a83so2867007a12.3 for ; Tue, 16 Apr 2024 08:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713281929; x=1713886729; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=GX9KZCftxTjAL8AJK/BXyQ0I2jqTuOcort2R9zv+35E=; b=uO+H8F9LL7XbiC/mANqs+70f+NI5gYF+RHF547JxDLaBeANGFo6j8ldPkj3kgMOVID zCPP832+SXhdfug2C8AfaCWjmgoNZYKsZdiwr5mnwxnehkmLyA8scFoeNAAZ59eFlvy6 f+PR7bMtrRZCCaOIkuCPkgixwH8Y8/cxlr8W9oEeI+1y7Q6vf2j1R0IuEvOJ0DdJ9E6O C0ek8pE1x1dVYVgl9LCLxVaM01yeptQ9QHGIa+uKGNX0nH6yNe7+n1J2y7cQHq6ZANRA I4LkeREO9duUuYVzBOOwsF4YpWeh8Sk9hRNTH3vk9C9aG/DwzhqXbdr4i1Ybpo0vsm/X oS8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713281929; x=1713886729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GX9KZCftxTjAL8AJK/BXyQ0I2jqTuOcort2R9zv+35E=; b=wCiXJABy+7tL8UUSKr7IIXNdlcqCIWkSn5fMA+HzoQqPA9A9FzqL/qa7znrMZXu1d2 0MmY7CcIBYhTy579FHF+RM/nBCxp6Tax5vWY3BzqGbs9uQwdfBKkgbTOI0dtElo2cJ0c kQDgioyxp8N2vDwFW8wvz7m6hjLCrmoHSg83GOSdAHIeGOigVmQT6AWMsyRESZcHKhLO 4znl6E2vs9/gn+Ocx9yccxDA4ToyuFgA5opUb70xuVFWfm+EiE28VTm7krHIsHVSNlOh DIlz7+i342v85ZH1YC/P9+8BnSycrgZ1CTmLJqedC0FOwjc4MSG+VKOHE4XEuEc5L0Y8 ANSw== X-Gm-Message-State: AOJu0YzGZTmUL3xmLugvxY63V9hsOBRDjZ2QISUXu8LgBHANFvttQ90C /tOIRDVHNS6KpFPams1k9MjMuj6DOwVEk1cTZtOuiJ+JfANeV/fPw6E+lXWhu7A= X-Google-Smtp-Source: AGHT+IH+jiCPZtetqoY/eWaznFgD4q8MOkguKJd6qiBINc+GIaZhQJhgkc0K+sPDVvaCiszku9Mi3g== X-Received: by 2002:a17:90a:bc88:b0:2a0:4073:deda with SMTP id x8-20020a17090abc8800b002a04073dedamr11176137pjr.20.1713281928844; Tue, 16 Apr 2024 08:38:48 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id o13-20020a17090ac08d00b002a2f3cfc92asm10637720pjs.16.2024.04.16.08.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:38:48 -0700 (PDT) Date: Tue, 16 Apr 2024 08:38:46 -0700 From: Stephen Hemminger To: bugzilla@dpdk.org Cc: dev@dpdk.org Subject: Re: [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets Message-ID: <20240416083846.08e8dcad@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 16 Apr 2024 10:29:53 +0000 bugzilla@dpdk.org wrote: > static uint16_t > eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > { > ... > for (i = 0; i < nb_pkts; i++) { > mbuf = *bufs++; > > ... > > /* insert vlan info if necessary */ > if (mbuf->ol_flags & RTE_MBUF_F_TX_VLAN) { > if (rte_vlan_insert(&mbuf)) { > rte_pktmbuf_free(mbuf); > continue; > > AFAIU, it does copy of mbuf contents into pbuf anyway (just few line below). > So the fix might be - simply insert VLAN tag at copying stage. > Feel free to correct me, if I missed something. vlan_insert will fail if the mbuf is has refcnt > 1. static inline int rte_vlan_insert(struct rte_mbuf **m) { struct rte_ether_hdr *oh, *nh; struct rte_vlan_hdr *vh; /* Can't insert header if mbuf is shared */ if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1) return -EINVAL;