Checking that one of RTE_MBUF_F_TX_IPV4 or RTE_MBUF_F_TX_IP_CKSUM is
present is not compliant with the offloading API which specifies that IP
checksum requires RTE_MBUF_F_TX_IP_CKSUM.
On the other hand, RTE_MBUF_F_TX_IP_CKSUM is invalid for IPv6 packets,
so we can simply check for RTE_MBUF_F_TX_IP_CKSUM and assume this is an
IPv4 packet.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
 drivers/net/tap/rte_eth_tap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 0ab214847a..30b45ddc67 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -559,7 +559,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned 
int l2_len,
 {
        void *l3_hdr = packet + l2_len;
 
-       if (ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4)) {
+       if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
                struct rte_ipv4_hdr *iph = l3_hdr;
                uint16_t cksum;
 
@@ -642,7 +642,7 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs,
 
                nb_segs = mbuf->nb_segs;
                if (txq->csum &&
-                   ((mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | 
RTE_MBUF_F_TX_IPV4) ||
+                   ((mbuf->ol_flags & RTE_MBUF_F_TX_IP_CKSUM ||
                      (mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == 
RTE_MBUF_F_TX_UDP_CKSUM ||
                      (mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == 
RTE_MBUF_F_TX_TCP_CKSUM))) {
                        unsigned int l4_len = 0;
-- 
2.41.0

Reply via email to