net/sfc/base: support VNI/VSID and inner frame local MAC

This supports VNI/VSID and inner frame local MAC fields to
match in VXLAN, GENEVE, or NVGRE packets.

Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
This commit is contained in:
Roman Zhukov 2018-03-06 15:24:47 +00:00 committed by Ferruh Yigit
parent 571f1c74d3
commit 8c1439d092
2 changed files with 26 additions and 0 deletions

View File

@ -119,6 +119,10 @@ ef10_filter_init(
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_OUTER_VLAN)); MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_OUTER_VLAN));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO == EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IP_PROTO)); MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IP_PROTO));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_VNI_OR_VSID ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_VNI_OR_VSID));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_LOC_MAC ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_DST_MAC));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST == EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_MCAST_DST)); MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_MCAST_DST));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST == EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST ==
@ -292,6 +296,12 @@ efx_mcdi_filter_op_add(
rc = EINVAL; rc = EINVAL;
goto fail2; goto fail2;
} }
memcpy(MCDI_IN2(req, uint8_t, FILTER_OP_EXT_IN_VNI_OR_VSID),
spec->efs_vni_or_vsid, EFX_VNI_OR_VSID_LEN);
memcpy(MCDI_IN2(req, uint8_t, FILTER_OP_EXT_IN_IFRM_DST_MAC),
spec->efs_ifrm_loc_mac, EFX_MAC_ADDR_LEN);
} }
efx_mcdi_execute(enp, &req); efx_mcdi_execute(enp, &req);
@ -415,6 +425,12 @@ ef10_filter_equal(
return (B_FALSE); return (B_FALSE);
if (left->efs_encap_type != right->efs_encap_type) if (left->efs_encap_type != right->efs_encap_type)
return (B_FALSE); return (B_FALSE);
if (memcmp(left->efs_vni_or_vsid, right->efs_vni_or_vsid,
EFX_VNI_OR_VSID_LEN))
return (B_FALSE);
if (memcmp(left->efs_ifrm_loc_mac, right->efs_ifrm_loc_mac,
EFX_MAC_ADDR_LEN))
return (B_FALSE);
return (B_TRUE); return (B_TRUE);
@ -988,6 +1004,8 @@ ef10_filter_supported_filters(
EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT | EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT |
EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID | EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID |
EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO | EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO |
EFX_FILTER_MATCH_VNI_OR_VSID |
EFX_FILTER_MATCH_IFRM_LOC_MAC |
EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST | EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST |
EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST | EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST |
EFX_FILTER_MATCH_UNKNOWN_MCAST_DST | EFX_FILTER_MATCH_UNKNOWN_MCAST_DST |

View File

@ -454,6 +454,8 @@ typedef enum efx_link_mode_e {
#define EFX_MAC_ADDR_LEN 6 #define EFX_MAC_ADDR_LEN 6
#define EFX_VNI_OR_VSID_LEN 3
#define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 0x01) #define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 0x01)
#define EFX_MAC_MULTICAST_LIST_MAX 256 #define EFX_MAC_MULTICAST_LIST_MAX 256
@ -2475,6 +2477,10 @@ typedef uint8_t efx_filter_flags_t;
#define EFX_FILTER_MATCH_OUTER_VID 0x00000100 #define EFX_FILTER_MATCH_OUTER_VID 0x00000100
/* Match by IP transport protocol */ /* Match by IP transport protocol */
#define EFX_FILTER_MATCH_IP_PROTO 0x00000200 #define EFX_FILTER_MATCH_IP_PROTO 0x00000200
/* Match by VNI or VSID */
#define EFX_FILTER_MATCH_VNI_OR_VSID 0x00000800
/* For encapsulated packets, match by inner frame local MAC address */
#define EFX_FILTER_MATCH_IFRM_LOC_MAC 0x00010000
/* For encapsulated packets, match all multicast inner frames */ /* For encapsulated packets, match all multicast inner frames */
#define EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST 0x01000000 #define EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST 0x01000000
/* For encapsulated packets, match all unicast inner frames */ /* For encapsulated packets, match all unicast inner frames */
@ -2521,6 +2527,8 @@ typedef struct efx_filter_spec_s {
uint16_t efs_rem_port; uint16_t efs_rem_port;
efx_oword_t efs_rem_host; efx_oword_t efs_rem_host;
efx_oword_t efs_loc_host; efx_oword_t efs_loc_host;
uint8_t efs_vni_or_vsid[EFX_VNI_OR_VSID_LEN];
uint8_t efs_ifrm_loc_mac[EFX_MAC_ADDR_LEN];
} efx_filter_spec_t; } efx_filter_spec_t;