diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/skbuff.h | 131 |
1 files changed, 75 insertions, 56 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 06bedeb0d49e..c5cd016f5120 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -34,11 +34,82 @@ | |||
| 34 | #include <linux/netdev_features.h> | 34 | #include <linux/netdev_features.h> |
| 35 | #include <net/flow_keys.h> | 35 | #include <net/flow_keys.h> |
| 36 | 36 | ||
| 37 | /* A. Checksumming of received packets by device. | ||
| 38 | * | ||
| 39 | * CHECKSUM_NONE: | ||
| 40 | * | ||
| 41 | * Device failed to checksum this packet e.g. due to lack of capabilities. | ||
| 42 | * The packet contains full (though not verified) checksum in packet but | ||
| 43 | * not in skb->csum. Thus, skb->csum is undefined in this case. | ||
| 44 | * | ||
| 45 | * CHECKSUM_UNNECESSARY: | ||
| 46 | * | ||
| 47 | * The hardware you're dealing with doesn't calculate the full checksum | ||
| 48 | * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums | ||
| 49 | * for specific protocols e.g. TCP/UDP/SCTP, then, for such packets it will | ||
| 50 | * set CHECKSUM_UNNECESSARY if their checksums are okay. skb->csum is still | ||
| 51 | * undefined in this case though. It is a bad option, but, unfortunately, | ||
| 52 | * nowadays most vendors do this. Apparently with the secret goal to sell | ||
| 53 | * you new devices, when you will add new protocol to your host, f.e. IPv6 8) | ||
| 54 | * | ||
| 55 | * CHECKSUM_COMPLETE: | ||
| 56 | * | ||
| 57 | * This is the most generic way. The device supplied checksum of the _whole_ | ||
| 58 | * packet as seen by netif_rx() and fills out in skb->csum. Meaning, the | ||
| 59 | * hardware doesn't need to parse L3/L4 headers to implement this. | ||
| 60 | * | ||
| 61 | * Note: Even if device supports only some protocols, but is able to produce | ||
| 62 | * skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY. | ||
| 63 | * | ||
| 64 | * CHECKSUM_PARTIAL: | ||
| 65 | * | ||
| 66 | * This is identical to the case for output below. This may occur on a packet | ||
| 67 | * received directly from another Linux OS, e.g., a virtualized Linux kernel | ||
| 68 | * on the same host. The packet can be treated in the same way as | ||
| 69 | * CHECKSUM_UNNECESSARY, except that on output (i.e., forwarding) the | ||
| 70 | * checksum must be filled in by the OS or the hardware. | ||
| 71 | * | ||
| 72 | * B. Checksumming on output. | ||
| 73 | * | ||
| 74 | * CHECKSUM_NONE: | ||
| 75 | * | ||
| 76 | * The skb was already checksummed by the protocol, or a checksum is not | ||
| 77 | * required. | ||
| 78 | * | ||
| 79 | * CHECKSUM_PARTIAL: | ||
| 80 | * | ||
| 81 | * The device is required to checksum the packet as seen by hard_start_xmit() | ||
| 82 | * from skb->csum_start up to the end, and to record/write the checksum at | ||
| 83 | * offset skb->csum_start + skb->csum_offset. | ||
| 84 | * | ||
| 85 | * The device must show its capabilities in dev->features, set up at device | ||
| 86 | * setup time, e.g. netdev_features.h: | ||
| 87 | * | ||
| 88 | * NETIF_F_HW_CSUM - It's a clever device, it's able to checksum everything. | ||
| 89 | * NETIF_F_IP_CSUM - Device is dumb, it's able to checksum only TCP/UDP over | ||
| 90 | * IPv4. Sigh. Vendors like this way for an unknown reason. | ||
| 91 | * Though, see comment above about CHECKSUM_UNNECESSARY. 8) | ||
| 92 | * NETIF_F_IPV6_CSUM - About as dumb as the last one but does IPv6 instead. | ||
| 93 | * NETIF_F_... - Well, you get the picture. | ||
| 94 | * | ||
| 95 | * CHECKSUM_UNNECESSARY: | ||
| 96 | * | ||
| 97 | * Normally, the device will do per protocol specific checksumming. Protocol | ||
| 98 | * implementations that do not want the NIC to perform the checksum | ||
| 99 | * calculation should use this flag in their outgoing skbs. | ||
| 100 | * | ||
| 101 | * NETIF_F_FCOE_CRC - This indicates that the device can do FCoE FC CRC | ||
| 102 | * offload. Correspondingly, the FCoE protocol driver | ||
| 103 | * stack should use CHECKSUM_UNNECESSARY. | ||
| 104 | * | ||
| 105 | * Any questions? No questions, good. --ANK | ||
| 106 | */ | ||
| 107 | |||
| 37 | /* Don't change this without changing skb_csum_unnecessary! */ | 108 | /* Don't change this without changing skb_csum_unnecessary! */ |
| 38 | #define CHECKSUM_NONE 0 | 109 | #define CHECKSUM_NONE 0 |
| 39 | #define CHECKSUM_UNNECESSARY 1 | 110 | #define CHECKSUM_UNNECESSARY 1 |
| 40 | #define CHECKSUM_COMPLETE 2 | 111 | #define CHECKSUM_COMPLETE 2 |
| 41 | #define CHECKSUM_PARTIAL 3 | 112 | #define CHECKSUM_PARTIAL 3 |
| 42 | 113 | ||
| 43 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ | 114 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ |
| 44 | ~(SMP_CACHE_BYTES - 1)) | 115 | ~(SMP_CACHE_BYTES - 1)) |
| @@ -54,58 +125,6 @@ | |||
| 54 | SKB_DATA_ALIGN(sizeof(struct sk_buff)) + \ | 125 | SKB_DATA_ALIGN(sizeof(struct sk_buff)) + \ |
| 55 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) | 126 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) |
| 56 | 127 | ||
| 57 | /* A. Checksumming of received packets by device. | ||
| 58 | * | ||
| 59 | * NONE: device failed to checksum this packet. | ||
| 60 | * skb->csum is undefined. | ||
| 61 | * | ||
| 62 | * UNNECESSARY: device parsed packet and wouldbe verified checksum. | ||
| 63 | * skb->csum is undefined. | ||
| 64 | * It is bad option, but, unfortunately, many of vendors do this. | ||
| 65 | * Apparently with secret goal to sell you new device, when you | ||
| 66 | * will add new protocol to your host. F.e. IPv6. 8) | ||
| 67 | * | ||
| 68 | * COMPLETE: the most generic way. Device supplied checksum of _all_ | ||
| 69 | * the packet as seen by netif_rx in skb->csum. | ||
| 70 | * NOTE: Even if device supports only some protocols, but | ||
| 71 | * is able to produce some skb->csum, it MUST use COMPLETE, | ||
| 72 | * not UNNECESSARY. | ||
| 73 | * | ||
| 74 | * PARTIAL: identical to the case for output below. This may occur | ||
| 75 | * on a packet received directly from another Linux OS, e.g., | ||
| 76 | * a virtualised Linux kernel on the same host. The packet can | ||
| 77 | * be treated in the same way as UNNECESSARY except that on | ||
| 78 | * output (i.e., forwarding) the checksum must be filled in | ||
| 79 | * by the OS or the hardware. | ||
| 80 | * | ||
| 81 | * B. Checksumming on output. | ||
| 82 | * | ||
| 83 | * NONE: skb is checksummed by protocol or csum is not required. | ||
| 84 | * | ||
| 85 | * PARTIAL: device is required to csum packet as seen by hard_start_xmit | ||
| 86 | * from skb->csum_start to the end and to record the checksum | ||
| 87 | * at skb->csum_start + skb->csum_offset. | ||
| 88 | * | ||
| 89 | * Device must show its capabilities in dev->features, set | ||
| 90 | * at device setup time. | ||
| 91 | * NETIF_F_HW_CSUM - it is clever device, it is able to checksum | ||
| 92 | * everything. | ||
| 93 | * NETIF_F_IP_CSUM - device is dumb. It is able to csum only | ||
| 94 | * TCP/UDP over IPv4. Sigh. Vendors like this | ||
| 95 | * way by an unknown reason. Though, see comment above | ||
| 96 | * about CHECKSUM_UNNECESSARY. 8) | ||
| 97 | * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. | ||
| 98 | * | ||
| 99 | * UNNECESSARY: device will do per protocol specific csum. Protocol drivers | ||
| 100 | * that do not want net to perform the checksum calculation should use | ||
| 101 | * this flag in their outgoing skbs. | ||
| 102 | * NETIF_F_FCOE_CRC this indicates the device can do FCoE FC CRC | ||
| 103 | * offload. Correspondingly, the FCoE protocol driver | ||
| 104 | * stack should use CHECKSUM_UNNECESSARY. | ||
| 105 | * | ||
| 106 | * Any questions? No questions, good. --ANK | ||
| 107 | */ | ||
| 108 | |||
| 109 | struct net_device; | 128 | struct net_device; |
| 110 | struct scatterlist; | 129 | struct scatterlist; |
| 111 | struct pipe_inode_info; | 130 | struct pipe_inode_info; |
