src/dpdk/drivers/net/enic/enic_flow.c
static int
copy_inner_common(struct filter_generic_1 *gp, uint8_t *inner_ofst,
		  const void *val, const void *mask, uint8_t val_size,
		  uint8_t proto_off, uint16_t proto_val, uint8_t proto_size)
{
	uint8_t *l5_mask, *l5_val;
	uint8_t start_off;

	/* No space left in the L5 pattern buffer. */
	start_off = *inner_ofst;
	if ((start_off + val_size) > FILTER_GENERIC_1_KEY_LEN)
		return ENOTSUP;
	l5_mask = gp->layer[FILTER_GENERIC_1_L5].mask;
	l5_val = gp->layer[FILTER_GENERIC_1_L5].val;
	/* Copy the pattern into the L5 buffer. */
	if (val) {
		memcpy(l5_mask + start_off, mask, val_size);
		memcpy(l5_val + start_off, val, val_size);
	}
	/* Set the protocol field in the previous header. */
	if (proto_off) {
		void *m, *v;

		m = l5_mask + proto_off;
		v = l5_val + proto_off;
		if (proto_size == 1) {
			*(uint8_t *)m = 0xff;
			*(uint8_t *)v = (uint8_t)proto_val;
		} else if (proto_size == 2) {
			*(uint16_t *)m = 0xffff;
			*(uint16_t *)v = proto_val;
		}
	}
	/* All inner headers land in L5 buffer even if their spec is null. */
	*inner_ofst += val_size;
	return 0;
}
/*
 * The common 'copy' function for all inner packet patterns. Patterns are
 * first appended to the L5 pattern buffer. Then, since the NIC filter
 * API has no special support for inner packet matching at the moment,
 * we set EtherType and IP proto as necessary.
 */
The common 'copy' function for all inner packet patterns. Patterns are
first appended to the L5 pattern buffer. Then, since the NIC filter
API has no special support for inner packet matching at the moment,
we set EtherType and IP proto as necessary.
The common ' copy ' function for all inner packet patterns . Patterns are first appended to the L5 pattern buffer . Then since the NIC filter API has no special support for inner packet matching at the moment we set EtherType and IP proto as necessary .
static int
copy_inner_common(struct filter_generic_1 *gp, uint8_t *inner_ofst,
		  const void *val, const void *mask, uint8_t val_size,
		  uint8_t proto_off, uint16_t proto_val, uint8_t proto_size)
{
	uint8_t *l5_mask, *l5_val;
	uint8_t start_off;
	start_off = *inner_ofst;
	if ((start_off + val_size) > FILTER_GENERIC_1_KEY_LEN)
		return ENOTSUP;
	l5_mask = gp->layer[FILTER_GENERIC_1_L5].mask;
	l5_val = gp->layer[FILTER_GENERIC_1_L5].val;
	if (val) {
		memcpy(l5_mask + start_off, mask, val_size);
		memcpy(l5_val + start_off, val, val_size);
	}
	if (proto_off) {
		void *m, *v;
		m = l5_mask + proto_off;
		v = l5_val + proto_off;
		if (proto_size == 1) {
			*(uint8_t *)m = 0xff;
			*(uint8_t *)v = (uint8_t)proto_val;
		} else if (proto_size == 2) {
			*(uint16_t *)m = 0xffff;
			*(uint16_t *)v = proto_val;
		}
	}
	*inner_ofst += val_size;
	return 0;
}
static int copy_inner_common ( struct filter_generic_1 * gp , uint8_t * inner_ofst , const void * val , const void * mask , uint8_t val_size , uint8_t proto_off , uint16_t proto_val , uint8_t proto_size ) { uint8_t * l5_mask , * l5_val ; uint8_t start_off ; start_off = * inner_ofst ; if ( ( start_off + val_size ) > FILTER_GENERIC_1_KEY_LEN ) return ENOTSUP ; l5_mask = gp -> layer [ FILTER_GENERIC_1_L5 ] . mask ; l5_val = gp -> layer [ FILTER_GENERIC_1_L5 ] . val ; if ( val ) { memcpy ( l5_mask + start_off , mask , val_size ) ; memcpy ( l5_val + start_off , val , val_size ) ; } if ( proto_off ) { void * m , * v ; m = l5_mask + proto_off ; v = l5_val + proto_off ; if ( proto_size == 1 ) { * ( uint8_t * ) m = 0xff ; * ( uint8_t * ) v = ( uint8_t ) proto_val ; } else if ( proto_size == 2 ) { * ( uint16_t * ) m = 0xffff ; * ( uint16_t * ) v = proto_val ; } } * inner_ofst += val_size ; return 0 ; }
The common 'copy' function for all inner packet patterns.
The common ' copy ' function for all inner packet patterns .
/* No space left in the L5 pattern buffer. */ /* Copy the pattern into the L5 buffer. */ /* Set the protocol field in the previous header. */ /* All inner headers land in L5 buffer even if their spec is null. */