sfxge(4): add helper API to make Geneve filter spec
Submitted by: Vijay Srivastava <vijays at solarflare.com> Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18272
This commit is contained in:
parent
fe094a7cbc
commit
1ad53cbf7e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341310
@ -2988,9 +2988,23 @@ efx_filter_spec_set_encap_type(
|
|||||||
__in efx_filter_inner_frame_match_t inner_frame_match);
|
__in efx_filter_inner_frame_match_t inner_frame_match);
|
||||||
|
|
||||||
extern __checkReturn efx_rc_t
|
extern __checkReturn efx_rc_t
|
||||||
efx_filter_spec_set_vxlan_full(
|
efx_filter_spec_set_vxlan(
|
||||||
__inout efx_filter_spec_t *spec,
|
__inout efx_filter_spec_t *spec,
|
||||||
__in const uint8_t *vxlan_id,
|
__in const uint8_t *vni,
|
||||||
|
__in const uint8_t *inner_addr,
|
||||||
|
__in const uint8_t *outer_addr);
|
||||||
|
|
||||||
|
extern __checkReturn efx_rc_t
|
||||||
|
efx_filter_spec_set_geneve(
|
||||||
|
__inout efx_filter_spec_t *spec,
|
||||||
|
__in const uint8_t *vni,
|
||||||
|
__in const uint8_t *inner_addr,
|
||||||
|
__in const uint8_t *outer_addr);
|
||||||
|
|
||||||
|
extern __checkReturn efx_rc_t
|
||||||
|
efx_filter_spec_set_nvgre(
|
||||||
|
__inout efx_filter_spec_t *spec,
|
||||||
|
__in const uint8_t *vsid,
|
||||||
__in const uint8_t *inner_addr,
|
__in const uint8_t *inner_addr,
|
||||||
__in const uint8_t *outer_addr);
|
__in const uint8_t *outer_addr);
|
||||||
|
|
||||||
|
@ -519,27 +519,42 @@ efx_filter_spec_set_encap_type(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Specify inner and outer Ethernet address and VXLAN ID in filter
|
* Specify inner and outer Ethernet address and VNI or VSID in tunnel filter
|
||||||
* specification.
|
* specification.
|
||||||
*/
|
*/
|
||||||
__checkReturn efx_rc_t
|
static __checkReturn efx_rc_t
|
||||||
efx_filter_spec_set_vxlan_full(
|
efx_filter_spec_set_tunnel(
|
||||||
__inout efx_filter_spec_t *spec,
|
__inout efx_filter_spec_t *spec,
|
||||||
__in const uint8_t *vxlan_id,
|
__in efx_tunnel_protocol_t encap_type,
|
||||||
|
__in const uint8_t *vni_or_vsid,
|
||||||
__in const uint8_t *inner_addr,
|
__in const uint8_t *inner_addr,
|
||||||
__in const uint8_t *outer_addr)
|
__in const uint8_t *outer_addr)
|
||||||
{
|
{
|
||||||
|
efx_rc_t rc;
|
||||||
|
|
||||||
EFSYS_ASSERT3P(spec, !=, NULL);
|
EFSYS_ASSERT3P(spec, !=, NULL);
|
||||||
EFSYS_ASSERT3P(vxlan_id, !=, NULL);
|
EFSYS_ASSERT3P(vni_or_vsid, !=, NULL);
|
||||||
EFSYS_ASSERT3P(inner_addr, !=, NULL);
|
EFSYS_ASSERT3P(inner_addr, !=, NULL);
|
||||||
EFSYS_ASSERT3P(outer_addr, !=, NULL);
|
EFSYS_ASSERT3P(outer_addr, !=, NULL);
|
||||||
|
|
||||||
if ((inner_addr == NULL) && (outer_addr == NULL))
|
switch (encap_type) {
|
||||||
return (EINVAL);
|
case EFX_TUNNEL_PROTOCOL_VXLAN:
|
||||||
|
case EFX_TUNNEL_PROTOCOL_GENEVE:
|
||||||
|
case EFX_TUNNEL_PROTOCOL_NVGRE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rc = EINVAL;
|
||||||
|
goto fail1;
|
||||||
|
}
|
||||||
|
|
||||||
if (vxlan_id != NULL) {
|
if ((inner_addr == NULL) && (outer_addr == NULL)) {
|
||||||
|
rc = EINVAL;
|
||||||
|
goto fail2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vni_or_vsid != NULL) {
|
||||||
spec->efs_match_flags |= EFX_FILTER_MATCH_VNI_OR_VSID;
|
spec->efs_match_flags |= EFX_FILTER_MATCH_VNI_OR_VSID;
|
||||||
memcpy(spec->efs_vni_or_vsid, vxlan_id, EFX_VNI_OR_VSID_LEN);
|
memcpy(spec->efs_vni_or_vsid, vni_or_vsid, EFX_VNI_OR_VSID_LEN);
|
||||||
}
|
}
|
||||||
if (outer_addr != NULL) {
|
if (outer_addr != NULL) {
|
||||||
spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC;
|
spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC;
|
||||||
@ -549,10 +564,63 @@ efx_filter_spec_set_vxlan_full(
|
|||||||
spec->efs_match_flags |= EFX_FILTER_MATCH_IFRM_LOC_MAC;
|
spec->efs_match_flags |= EFX_FILTER_MATCH_IFRM_LOC_MAC;
|
||||||
memcpy(spec->efs_ifrm_loc_mac, inner_addr, EFX_MAC_ADDR_LEN);
|
memcpy(spec->efs_ifrm_loc_mac, inner_addr, EFX_MAC_ADDR_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
spec->efs_match_flags |= EFX_FILTER_MATCH_ENCAP_TYPE;
|
spec->efs_match_flags |= EFX_FILTER_MATCH_ENCAP_TYPE;
|
||||||
spec->efs_encap_type = EFX_TUNNEL_PROTOCOL_VXLAN;
|
spec->efs_encap_type = encap_type;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
fail2:
|
||||||
|
EFSYS_PROBE(fail2);
|
||||||
|
fail1:
|
||||||
|
EFSYS_PROBE1(fail1, efx_rc_t, rc);
|
||||||
|
|
||||||
|
return (rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Specify inner and outer Ethernet address and VNI in VXLAN filter
|
||||||
|
* specification.
|
||||||
|
*/
|
||||||
|
__checkReturn efx_rc_t
|
||||||
|
efx_filter_spec_set_vxlan(
|
||||||
|
__inout efx_filter_spec_t *spec,
|
||||||
|
__in const uint8_t *vni,
|
||||||
|
__in const uint8_t *inner_addr,
|
||||||
|
__in const uint8_t *outer_addr)
|
||||||
|
{
|
||||||
|
return efx_filter_spec_set_tunnel(spec, EFX_TUNNEL_PROTOCOL_VXLAN,
|
||||||
|
vni, inner_addr, outer_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Specify inner and outer Ethernet address and VNI in Geneve filter
|
||||||
|
* specification.
|
||||||
|
*/
|
||||||
|
__checkReturn efx_rc_t
|
||||||
|
efx_filter_spec_set_geneve(
|
||||||
|
__inout efx_filter_spec_t *spec,
|
||||||
|
__in const uint8_t *vni,
|
||||||
|
__in const uint8_t *inner_addr,
|
||||||
|
__in const uint8_t *outer_addr)
|
||||||
|
{
|
||||||
|
return efx_filter_spec_set_tunnel(spec, EFX_TUNNEL_PROTOCOL_GENEVE,
|
||||||
|
vni, inner_addr, outer_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Specify inner and outer Ethernet address and vsid in NVGRE filter
|
||||||
|
* specification.
|
||||||
|
*/
|
||||||
|
__checkReturn efx_rc_t
|
||||||
|
efx_filter_spec_set_nvgre(
|
||||||
|
__inout efx_filter_spec_t *spec,
|
||||||
|
__in const uint8_t *vsid,
|
||||||
|
__in const uint8_t *inner_addr,
|
||||||
|
__in const uint8_t *outer_addr)
|
||||||
|
{
|
||||||
|
return efx_filter_spec_set_tunnel(spec, EFX_TUNNEL_PROTOCOL_NVGRE,
|
||||||
|
vsid, inner_addr, outer_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFSYS_OPT_RX_SCALE
|
#if EFSYS_OPT_RX_SCALE
|
||||||
|
Loading…
Reference in New Issue
Block a user