Files
@ d6b9b2ac5869
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/net/vmkapi_net_csum.h - annotation
d6b9b2ac5869
5.4 KiB
text/x-chdr
ESXi-5.5-U2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 91e0d39c9812 | /* **********************************************************
* Copyright 2011 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* NetCksum */ /**
* \addtogroup Network
*@{
* \defgroup NetCksum Network protocol checksum functions
*@{
*
***********************************************************************
*/
#ifndef _VMKAPI_NET_CKSUM_H_
#define _VMKAPI_NET_CKSUM_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
/*
***********************************************************************
* vmk_NetCsumFold -- */ /**
*
* \brief Fold a partial 32-bit checksum into a single 16-bit value.
*
* \param[in] sum Partial checksum to fold.
*
* \retval The folded checksum.
*
***********************************************************************
*/
static inline vmk_uint16 vmk_NetCsumFold(vmk_uint32 sum)
{
__asm__("addl %1, %0; adcl $0xffff, %0"
: "=r" (sum)
: "r" (sum << 16), "0" (sum & 0xffff0000));
return (~sum) >> 16;
}
/*
***********************************************************************
* vmk_NetCsumDataPartial -- */ /**
*
* \brief Checksum a block of data.
*
* \param[in] data Data to checksum
* \param[in] len Length of the data to checksum.
* \param[in] initialSum Initial checksum to add.
*
* \retval The resulting unfolded checksum.
*
***********************************************************************
*/
vmk_uint32 vmk_NetCsumDataPartial(void *data,
vmk_uint64 len,
vmk_uint32 initialSum);
/*
***********************************************************************
* vmk_NetCsumDataFinal -- */ /**
*
* \brief Checksum a block of data and fold the result.
*
* \param[in] data Data to checksum
* \param[in] len Length of the data to checksum.
* \param[in] initialSum Initial checksum to add.
*
* \retval The resulting checksum.
*
***********************************************************************
*/
static inline vmk_uint16 vmk_NetCsumDataFinal(void *data,
vmk_uint64 len,
vmk_uint32 initialSum)
{
return vmk_NetCsumFold(vmk_NetCsumDataPartial(data, len, initialSum));
}
/*
***********************************************************************
* vmk_NetCsumIPv4Pseudo -- */ /**
*
* \brief Checksum an IPv4 pseudo-header and fold the result.
*
* \param[in] saddr Source address of the IPv4 packed.
* \param[in] daddr Destination address of the IPv4 packed.
* \param[in] proto Protocol number of the payload.
* \param[in] totalLength Total length of the packet.
* \param[in] initialSum Initial checksum to add.
*
* \note saddr, daddr, and proto are direct pointers to the IPv4
* header's content; they are expected to be in network byte
* order. On the other hand, totalLength is the total length of
* the header + payload. It is expected to by in host byte order.
*
* \retval The resulting checksum.
*
***********************************************************************
*/
vmk_uint16 vmk_NetCsumIPv4Pseudo(const vmk_uint32 *saddr,
const vmk_uint32 *daddr,
const vmk_uint8 *proto,
vmk_uint16 totalLength,
vmk_uint32 initialSum);
/*
***********************************************************************
* vmk_NetCsumIPv6Pseudo -- */ /**
*
* \brief Checksum an IPv6 pseudo-header and fold the result.
*
* \param[in] saddr Source address of the IPv6 packed.
* \param[in] daddr Destination address of the IPv6 packed.
* \param[in] totalLength Length of the IPv6 packet.
* \param[in] proto Protocol number of the payload.
* \param[in] initialSum Initial checksum to add.
*
* \note saddr, daddr, and proto are direct pointers to the IPv6
* header's content; they are expected to be in network byte
* order. On the other hand, totalLength is the total length of
* the TCP header + payload. It is expected to by in host byte
* order.
*
* \note daddr will usually point to the IPv6 header's destination
* address, but when a routing header is present, the last element
* of the routing header must be used in the IPv6 pseudo header.
*
* \retval The resulting checksum.
*
***********************************************************************
*/
vmk_uint16 vmk_NetCsumIPv6Pseudo(const vmk_uint8 *saddr,
const vmk_uint8 *daddr,
const vmk_uint8 *proto,
vmk_uint16 totalLength,
vmk_uint32 initialSum);
#endif /* _VMKAPI_NET_CKSUM_H_ */
/** @} */
/** @} */
|