Since network device can auto calculate and verify the checksum of a
packet, for example: some e1000 interface. Different device will set
different value of skb->ip_summed.
  a) If device do nothing to checksum, skb->ip_summed would be set to
CHECKSUM_NONE.
  b) If device can only calculate a checksum, and the checksum is
correct, skb->ip_summed would be set to CHECKSUM_HW.
  c) If device can verify the checksum, and the checksum is correct,
skb->ip_summed would be set to CHECKSUM_UNNECESSARY.
  So if I want to trim a skb, I think I must do a checksum even if the
skb->ip_summed is CHECKSUM_UNNECESSARY.

Following is the comment about CHECKSUM_UNNECESSARY in
include/linux/skbuff.h:
 *      UNNECESSARY: device parsed packet and wouldbe verified checksum.
 *              skb->csum is undefined.
 *            It is bad option, but, unfortunately, many of vendors do this.
 *            Apparently with secret goal to sell you new device, when you
 *            will add new protocol to your host. F.e. IPv6. 8)

Signed-off-by: Wei Yongjun <[EMAIL PROTECTED]>


--- a/include/linux/skbuff.h    2006-07-17 10:14:23.175070472 -0400
+++ b/include/linux/skbuff.h    2006-07-17 10:18:31.762279472 -0400
@@ -1208,8 +1208,8 @@ static inline int pskb_trim_rcsum(struct
 {
        if (likely(len >= skb->len))
                return 0;
-       if (skb->ip_summed == CHECKSUM_HW)
-               skb->ip_summed = CHECKSUM_NONE;
+
+       skb->ip_summed = CHECKSUM_NONE;
        return __pskb_trim(skb, len);
 }
 


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to