DPDK patches and discussions
 help / color / mirror / Atom feed
* [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets
@ 2024-04-16 10:29 bugzilla
  2024-04-16 15:38 ` Stephen Hemminger
  2024-04-16 15:58 ` bugzilla
  0 siblings, 2 replies; 9+ messages in thread
From: bugzilla @ 2024-04-16 10:29 UTC (permalink / raw)
  To: dev

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

https://bugs.dpdk.org/show_bug.cgi?id=1416

            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 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" 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 = 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #2: Type: text/html, Size: 3625 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-16 22:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 10:29 [DPDK/ethdev Bug 1416] net/af_packet: tx_burst() can modify packets bugzilla
2024-04-16 15:38 ` Stephen Hemminger
2024-04-16 15:56   ` Konstantin Ananyev
2024-04-16 16:14     ` Morten Brørup
2024-04-16 16:42       ` Konstantin Ananyev
2024-04-16 18:11         ` Morten Brørup
2024-04-16 20:09           ` Stephen Hemminger
2024-04-16 22:21             ` Morten Brørup
2024-04-16 15:58 ` bugzilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).