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 mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08BD4C4345F for ; Tue, 16 Apr 2024 10:29:55 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39ABD402AE; Tue, 16 Apr 2024 12:29:55 +0200 (CEST) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id D3A7F4029E for ; Tue, 16 Apr 2024 12:29:53 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id C4A4143E74; Tue, 16 Apr 2024 12:29:53 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Subject: [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets Date: Tue, 16 Apr 2024 10:29:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: ethdev X-Bugzilla-Version: 24.03 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: konstantin.v.ananyev@yandex.ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: multipart/alternative; boundary=17132633930.618E3f.867844 Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All 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 --17132633930.618E3f.867844 Date: Tue, 16 Apr 2024 12:29:53 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All https://bugs.dpdk.org/show_bug.cgi?id=3D1416 Bug ID: 1416 Summary: net/af_packet: tx_burst() can modify packets Product: DPDK Version: 24.03 Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: Normal Component: ethdev Assignee: dev@dpdk.org Reporter: konstantin.v.ananyev@yandex.ru Target Milestone: --- According to the ethdev doc, in general, PMD tx_burst() should not modify m= buf contents. To be more specific: ethdev/rte_ethdev.h:6396 ... * @note This function must not modify mbufs (including packets data) * unless the refcnt is 1. * An exception is the bonding PMD, which does not have "Tx prepare" suppor= t, * in this case, mbufs may be modified. ... Though why looking at eth_af_packet_tx(), it looks to me like it does modify the packet contents without any checks for refcnt, etc.: 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;=20 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. --=20 You are receiving this mail because: You are the assignee for the bug.= --17132633930.618E3f.867844 Date: Tue, 16 Apr 2024 12:29:53 +0200 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All
Bug ID 1416
Summary net/af_packet: tx_burst() can modify packets
Product DPDK
Version 24.03
Hardware All
OS All
Status UNCONFIRMED
Severity normal
Priority Normal
Component ethdev
Assignee dev@dpdk.org
Reporter konstantin.v.ananyev@yandex.ru
Target Milestone ---

According to the ethdev doc, in ge=
neral, PMD tx_burst() should not modify mbuf
contents. To be more specific:

ethdev/rte_ethdev.h:6396
...
 * @note This function must not modify mbufs (including packets data)
 * unless the refcnt is 1.
 * An exception is the bonding PMD, which does not have "Tx prepare&qu=
ot; support,
 * in this case, mbufs may be modified.
...

Though why looking at eth_af_packet_tx(), it looks to me like it does modify
the packet contents without any checks for refcnt, etc.:

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;=20

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.
          


You are receiving this mail because:
  • You are the assignee for the bug.
=20=20=20=20=20=20=20=20=20=20
= --17132633930.618E3f.867844--