dpdk: correct the printing of Rx offloading flags 81/39581/3
authorJieqiang Wang <jieqiang.wang@arm.com>
Mon, 21 Aug 2023 07:58:10 +0000 (15:58 +0800)
committerMohammed HAWARI <momohawari@gmail.com>
Mon, 6 Nov 2023 10:21:35 +0000 (10:21 +0000)
DPDK added new Rx checksum flags[1] to handle cases like the virtual
drivers. Current check of flags is not strict enough for flags like
RTE_MBUF_F_RX_IP_CKSUM_NONE and will always be true no matter the
checksum in packet is good or bad.
Fix this issue by comparing the result of AND operation with the
correspinding Rx checksum flags.

Before this patch, packet trace prints the offload flags as below:

    Packet Offload Flags
      PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
      PKT_RX_IP_CKSUM_NONE (0x0090) no IP cksum of RX pkt.
      PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid
      PKT_RX_L4_CKSUM_NONE (0x0108) no L4 cksum of RX pkt.

After this patch, packet offload flags would be like:

    Packet Offload Flags
      PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
      PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid

Type: fix

[1] https://github.com/DPDK/dpdk/commit/5842289a546ceb0072bd7faccb93821e21848e07

Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
Change-Id: I3182022d9ccd46b2fc55bb3edfbfac9062ed7c89

src/plugins/dpdk/device/format.c

index 1143534..1fd609a 100644 (file)
@@ -706,7 +706,7 @@ format_dpdk_pkt_offload_flags (u8 * s, va_list * va)
   s = format (s, "Packet Offload Flags");
 
 #define _(F, S)                                                               \
-  if (*ol_flags & RTE_MBUF_F_##F)                                             \
+  if ((*ol_flags & RTE_MBUF_F_##F) == RTE_MBUF_F_##F)                         \
     {                                                                         \
       s = format (s, "\n%U%s (0x%04x) %s", format_white_space, indent,        \
                  "PKT_" #F, RTE_MBUF_F_##F, S);                              \