Hi,

this diff add hardware checksum offloading for the receive path of
ixl(4) interfaces.

Tested on:
ixl1 at pci3 dev 0 function 1 "Intel X710 SFP+" rev 0x02: port 1, FW 6.0.48442 
API 1.7, msix, 8 queues, address 40:a6:b7:02:38:3d

OK?

Index: dev/pci/if_ixl.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ixl.c,v
retrieving revision 1.75
diff -u -p -r1.75 if_ixl.c
--- dev/pci/if_ixl.c    23 Jul 2021 00:29:14 -0000      1.75
+++ dev/pci/if_ixl.c    22 Oct 2021 09:20:59 -0000
@@ -1388,6 +1388,7 @@ static int        ixl_rxeof(struct ixl_softc *,
 static void    ixl_rxfill(struct ixl_softc *, struct ixl_rx_ring *);
 static void    ixl_rxrefill(void *);
 static int     ixl_rxrinfo(struct ixl_softc *, struct if_rxrinfo *);
+static void    ixl_rx_checksum(struct mbuf *, uint64_t);
 
 #if NKSTAT > 0
 static void    ixl_kstat_attach(struct ixl_softc *);
@@ -3190,6 +3191,7 @@ ixl_rxeof(struct ixl_softc *sc, struct i
                                        m->m_pkthdr.csum_flags |= M_FLOWID;
                                }
 
+                               ixl_rx_checksum(m, word);
                                ml_enqueue(&ml, m);
                        } else {
                                ifp->if_ierrors++; /* XXX */
@@ -3320,6 +3322,23 @@ ixl_rxrinfo(struct ixl_softc *sc, struct
        free(ifr, M_TEMP, ixl_nqueues(sc) * sizeof(*ifr));
 
        return (rv);
+}
+
+static void
+ixl_rx_checksum(struct mbuf *m, uint64_t word)
+{
+       if (!ISSET(word, IXL_RX_DESC_L3L4P))
+               return;
+
+       if (ISSET(word, IXL_RX_DESC_IPE))
+               return;
+
+       m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
+
+       if (ISSET(word, IXL_RX_DESC_L4E))
+               return;
+
+       m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK | M_UDP_CSUM_IN_OK;
 }
 
 static int

Reply via email to