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 2367D43E83; Tue, 16 Apr 2024 17:56:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A09DC40268; Tue, 16 Apr 2024 17:56:09 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 8489340262 for ; Tue, 16 Apr 2024 17:56:08 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VJpW54Q5lz6H7kw; Tue, 16 Apr 2024 23:54:09 +0800 (CST) Received: from frapeml500006.china.huawei.com (unknown [7.182.85.219]) by mail.maildlp.com (Postfix) with ESMTPS id E05A01400D9; Tue, 16 Apr 2024 23:56:06 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500006.china.huawei.com (7.182.85.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 16 Apr 2024 17:56:06 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035; Tue, 16 Apr 2024 17:56:06 +0200 From: Konstantin Ananyev To: Stephen Hemminger CC: "dev@dpdk.org" Subject: RE: [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets Thread-Topic: [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets Thread-Index: AQHaj+klsHkMFtD6mEu3P6qfirzOCbFq5v0AgAAmCbA= Date: Tue, 16 Apr 2024 15:56:06 +0000 Message-ID: <2b4a3bac389141bbae7a2d0ec31df5c6@huawei.com> References: <20240416083846.08e8dcad@hermes.local> In-Reply-To: <20240416083846.08e8dcad@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 >=20 > > static uint16_t > > eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > > { > > ... > > for (i =3D 0; i < nb_pkts; i++) { > > mbuf =3D *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 be= low). > > So the fix might be - simply insert VLAN tag at copying stage. > > Feel free to correct me, if I missed something. >=20 > vlan_insert will fail if the mbuf is has refcnt > 1. >=20 > static inline int rte_vlan_insert(struct rte_mbuf **m) > { > struct rte_ether_hdr *oh, *nh; > struct rte_vlan_hdr *vh; >=20 > /* Can't insert header if mbuf is shared */ > if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1) > return -EINVAL; You are right, I missed that. Will close it then. Thanks Konstantin