From: Guo-Fu Tseng <coolda...@cooldavid.org>

Read corresponding flags for RX checksum status, and update the
csum_stat field of the struct io_buffer.

Signed-off-by: Guo-Fu Tseng <coolda...@cooldavid.org>
---
 src/drivers/net/jme.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/drivers/net/jme.c b/src/drivers/net/jme.c
index 17277d1..cc39222 100644
--- a/src/drivers/net/jme.c
+++ b/src/drivers/net/jme.c
@@ -589,6 +589,29 @@ jme_disable_rx_engine(struct jme_adapter *jme)
 
 }
 
+static int
+jme_rxsum(u16 flags)
+{
+       if (!(flags & (RXWBFLAG_TCPON | RXWBFLAG_UDPON | RXWBFLAG_IPV4)))
+               return CHECKSUM_NONE;
+
+       if ((flags & (RXWBFLAG_MF | RXWBFLAG_TCPON | RXWBFLAG_TCPCS))
+                       == RXWBFLAG_TCPON) {
+               return CHECKSUM_NONE;
+       }
+
+       if ((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS))
+                       == RXWBFLAG_UDPON) {
+               return CHECKSUM_NONE;
+       }
+
+       if ((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS)) == RXWBFLAG_IPV4) {
+               return CHECKSUM_NONE;
+       }
+
+       return CHECKSUM_COMPLETE;
+}
+
 static void
 jme_refill_rx_ring(struct jme_adapter *jme, int curhole)
 {
@@ -624,6 +647,7 @@ jme_alloc_and_feed_iob(struct jme_adapter *jme, int idx)
 
        framesize = le16_to_cpu(rxdesc->descwb.framesize);
        iob_put(rxbi, framesize);
+       rxbi->csum_stat = jme_rxsum(le16_to_cpu(rxdesc->descwb.flags));
        netdev_rx(netdev, rxbi);
 
        rxring->bufinf[idx] = NULL;
-- 
1.7.1

_______________________________________________
gPXE-devel mailing list
gPXE-devel@etherboot.org
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to