[dpdk-dev] Always get the CRC from mbuf

Alexandru Nicolae alexandru.nicolae0807 at yahoo.com
Tue May 8 12:50:10 CEST 2018


Hello,
I saw a few discussions about CRC in the dpdk context, but none of them seem to offer a consistent solution to retrieve the CRC from a mbuf.
What I mainly need  is to know if a packet have a good/bad CRC. This would be easy if there would be a flag in the mbuf structure to signal this.
Having this in mind, I tried to propagate this information from driver to the mbuf by creating such a flag, but it seems that (for ixgbe at least) the driver doesn't make the difference between different packet errors (bad CRC, oversize, undersize, length error) and it will set the same error flag in the status_error field of a rx descriptor for each of these errors: IXGBE_RXDADV_ERR_RXE = 0x20000000 (/* ANY MAC ERROR */).
Moving forward, I've decided to extract the CRC from the mbuf knowing that if DEV_RX_OFFLOAD_CRC_STRIP flag isn't set, the driver will copy the CRC in the mbuf after mbuf->pkt_len.
This seems to work well in some cases, but there are certain scenarios when the CRC isn't copied at the end of the mbuf. For example, if we receive a 2052 packet (including CRC) and the mbuf pool is configured with 3000B mbufs (mbuf->buf_len), our mbuf will contain 2048 B of data and NO CRC after pkt_len.
Also, someone stated previously that we can hit "the [rare] case where the CRC would have been the only data stored into the last segment of a scattered input packet". I wasn't able to reproduce this corner case because of the previous behavior: the CRC isn't copied at all in the last segment.
Do you guys know if there is a best practice to extract the CRC? Or if there is a way to properly configure the mbuf_pool to avoid the second issue I've exposed?
Thank you,Alex



More information about the dev mailing list