43 _ip_incremental_checksum (
ip_csum_t sum,
void *_data,
uword n_bytes)
58 if (n_bytes >= sizeof (t) \ 59 && sizeof (t) < sizeof (ip_csum_t) \ 60 && (data % (2 * sizeof (t))) != 0) \ 62 sum0 += * uword_to_pointer (data, t *); \ 64 n_bytes -= sizeof (t); \ 79 while (n_bytes >= 2 *
sizeof (d[0]))
84 n_bytes -= 2 *
sizeof (d[0]);
92 if (n_bytes >= sizeof (t) && sizeof (t) <= sizeof (ip_csum_t)) \ 94 sum0 = ip_csum_with_carry (sum0, * uword_to_pointer (data, t *)); \ 96 n_bytes -= sizeof (t); \ 137 static const char test_pkt[] = {
138 0x45, 0x00, 0x00, 0x3c, 0x5d, 0x6f, 0x40, 0x00,
139 0x40, 0x06, 0x3f, 0x6b, 0x0a, 0x76, 0x72, 0x44,
140 0x0a, 0x56, 0x16, 0xd2,
154 for (offset = 0; offset < 8; offset++)
156 memcpy (align_test + offset, test_pkt,
ARRAY_LEN (test_pkt));
171 .path =
"test ip checksum",
172 .short_help =
"test ip checksum",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * test_ip_checksum_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip_csum_t(* vnet_incremental_checksum_fp)(ip_csum_t, void *, uword)
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * ip_checksum_init(vlib_main_t *vm)
#define VLIB_CLI_COMMAND(x,...)
#define uword_to_pointer(u, type)
static uword pointer_to_uword(const void *p)
struct clib_bihash_value offset
template key/value backing page structure
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u16 ip4_header_checksum(ip4_header_t *i)