<div dir="ltr">Hello Patrick,<br><br>You can use rte_net_get_ptype function directly if packet_type is RTE_PTYPE_UNKNOWN. <div>Whether the packet_type value is set is PMD/NIC dependent. </div><div>i40e does this at the hardware level, virtio does this in software with rte_net_get_ptype and only in the specific case.<br><br>Best regards,<br>Oleksandr</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 8, 2024 at 12:49 AM Patrick Mahan <<a href="mailto:mahan@mahan.org" target="_blank">mahan@mahan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello All,<br>
<br>
Specifics:<br>
    DPDK Version: dpdk-stable-18.11.11<br>
    Linux Kernel: 4.19.87<br>
    Intel 64-bit architecture<br>
<br>
I am working on a code to support our socket based processes that need to run on <br>
our DPDK-enabled platform.  I am using the virtio_user exception path mechanism <br>
to support this and initial tests seem fine.<br>
<br>
However, I am seeing issues when we receive the packet from the virtio port, that<br>
the packet_type field is not set.<br>
<br>
In my code, I have setup my physical PMD (i40e) as etherdev 0 and etherdev 1 and <br>
have setup the virtual side with virtio as  etherdev 2 and etherdev 3.<br>
<br>
I am pairing this as etherdev 0 (physical) to etherdev 2 (virtio_user0) and<br>
etherdev 1 (physical) to etherdev 3 (virtio_user1).<br>
<br>
I am using the EAL function `rte_eal_hotplug_add()` as suggested in the <br>
documentation.<br>
<br>
I have added code in my dispatch function to generate a syslog(3) to print the<br>
contents of the packet_type field in the received mbuf.<br>
<br>
I then generate traffic to etherdev 1 from connected host and I am seeing the <br>
following:<br>
<br>
The inbound packet log shows -<br>
<br>
Dec  7 21:24:45 2024 pmahan-dpdk pktdaemon-eal[27614]: CPU 2 TID <br>
1140607382984128: [pktdaemon.NOTICE]: pkt_dpdk::switch_q_pkts()[2][1=>3][Q=0]: <br>
mbuf packet type is 0x00000091<br>
<br>
So etherdev 1 packet (physical) has packet_type of 0x91 which translates to<br>
    RTE_PTYPE_L2_ETHER<br>
    RTE_PTYPE_L3_IPV4_EXT_UNKNOWN<br>
<br>
Which has been my experience for receiving packets from the physical PMD. <br>
However, now that I have added the virtio port, the return packet does not seemed <br>
to have this value set -<br>
<br>
Dec  7 21:24:45 2024 pmahan-dpdk pktdaemon-eal[27614]: CPU 2 TID <br>
1140607382984128: [pktdaemon.NOTICE]: pkt_dpdk::switch_q_pkts()[2][3=>1][Q=0]: <br>
mbuf packet type is 0x00000000<br>
<br>
I have looked into virtio PMD code and see that there is a function to fill in <br>
the packet type called `virtio_rx_offload()` but it is only called if the <br>
hardware associated with the virtual queue supports offloading and then only if <br>
the `virtio_net_hdr` has no flags or its `gso_type` is not GSO_NONE.<br>
<br>
If I ignore the flags and just inject the packets directly, everything seems to <br>
work, but I have internal code that needs to know the basic ethernet type as well <br>
as the L3 options and I was hoping to rely on the packet_type of the mbuf instead <br>
of having to do packet groveling.<br>
<br>
Is this an "as designed" or am I missing something in the configuration?<br>
<br>
Thanks for any pointers,<br>
<br>
Patrick<br>
</blockquote></div>