sfxge(4): split EFX_FILTER_MATCH_LOC_MAC_IG back into separate flags
The flag EFX_FILTER_MATCH_LOC_MAC_IG to represent filtering on the individual/group bit of the MAC address (with the two cases being distingusished by the MAC address in the filter specification) was introduced to mirror the Linux driver filtering code, but the implementations are different enough anyway that it isn't of much value. Having separate flags for unknown unicast and multicast simplifies the code and allows the set of flags to match those used by MCDI. It will also makes it easier to report whether these filters are supported. In the MCDI definitions, the unknown multicast and unicast flags have the values 0x40000000 and 0x80000000 respectively, and so using the same values for simplicity requires 32 bits in the filter specification to store the flags. This means the structure is now a little bigger than 64 bytes, but filters are not often used on critical paths so this shouldn't have much impact - on Linux they are also bigger than they used to be. Submitted by: Mark Spender <mspender at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8951
This commit is contained in:
parent
dae5708683
commit
a85ebf7757
@ -145,6 +145,10 @@ ef10_filter_init(
|
||||
MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_OUTER_VLAN));
|
||||
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO ==
|
||||
MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_IP_PROTO));
|
||||
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_UNKNOWN_MCAST_DST ==
|
||||
MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST));
|
||||
EFX_STATIC_ASSERT((uint32_t)EFX_FILTER_MATCH_UNKNOWN_UCAST_DST ==
|
||||
MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST));
|
||||
#undef MATCH_MASK
|
||||
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (ef10_filter_table_t), eftp);
|
||||
@ -187,7 +191,6 @@ efx_mcdi_filter_op_add(
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN,
|
||||
MC_CMD_FILTER_OP_OUT_LEN)];
|
||||
uint32_t match_fields = 0;
|
||||
efx_rc_t rc;
|
||||
|
||||
memset(payload, 0, sizeof (payload));
|
||||
@ -214,26 +217,10 @@ efx_mcdi_filter_op_add(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
if (spec->efs_match_flags & EFX_FILTER_MATCH_LOC_MAC_IG) {
|
||||
/*
|
||||
* The LOC_MAC_IG match flag can represent unknown unicast
|
||||
* or multicast filters - use the MAC address to distinguish
|
||||
* them.
|
||||
*/
|
||||
if (EFX_MAC_ADDR_IS_MULTICAST(spec->efs_loc_mac))
|
||||
match_fields |= 1U <<
|
||||
MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN;
|
||||
else
|
||||
match_fields |= 1U <<
|
||||
MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN;
|
||||
}
|
||||
|
||||
match_fields |= spec->efs_match_flags & (~EFX_FILTER_MATCH_LOC_MAC_IG);
|
||||
|
||||
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_PORT_ID,
|
||||
EVB_PORT_ID_ASSIGNED);
|
||||
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_MATCH_FIELDS,
|
||||
match_fields);
|
||||
spec->efs_match_flags);
|
||||
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_RX_DEST,
|
||||
MC_CMD_FILTER_OP_IN_RX_DEST_HOST);
|
||||
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_RX_QUEUE,
|
||||
@ -892,9 +879,6 @@ efx_mcdi_get_parser_disp_info(
|
||||
uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
|
||||
MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)];
|
||||
efx_rc_t rc;
|
||||
uint32_t i;
|
||||
boolean_t support_unknown_ucast = B_FALSE;
|
||||
boolean_t support_unknown_mcast = B_FALSE;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PARSER_DISP_INFO;
|
||||
@ -930,28 +914,6 @@ efx_mcdi_get_parser_disp_info(
|
||||
EFX_STATIC_ASSERT(sizeof (uint32_t) ==
|
||||
MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN);
|
||||
|
||||
/*
|
||||
* Remove UNKNOWN UCAST and MCAST flags, and if both are present, change
|
||||
* the lower priority one to LOC_MAC_IG.
|
||||
*/
|
||||
for (i = 0; i < *length; i++) {
|
||||
if (list[i] & MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN) {
|
||||
list[i] &=
|
||||
(~MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST_LBN);
|
||||
support_unknown_ucast = B_TRUE;
|
||||
}
|
||||
if (list[i] & MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN) {
|
||||
list[i] &=
|
||||
(~MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST_LBN);
|
||||
support_unknown_mcast = B_TRUE;
|
||||
}
|
||||
|
||||
if (support_unknown_ucast && support_unknown_mcast) {
|
||||
list[i] &= EFX_FILTER_MATCH_LOC_MAC_IG;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
fail2:
|
||||
|
@ -2209,10 +2209,10 @@ typedef enum efx_filter_match_flags_e {
|
||||
EFX_FILTER_MATCH_OUTER_VID = 0x0100, /* Match by outer VLAN ID */
|
||||
EFX_FILTER_MATCH_IP_PROTO = 0x0200, /* Match by IP transport
|
||||
* protocol */
|
||||
EFX_FILTER_MATCH_LOC_MAC_IG = 0x0400, /* Match by local MAC address
|
||||
* I/G bit. Used for RX default
|
||||
* unicast and multicast/
|
||||
* broadcast filters. */
|
||||
/* Match otherwise-unmatched multicast and broadcast packets */
|
||||
EFX_FILTER_MATCH_UNKNOWN_MCAST_DST = 0x40000000,
|
||||
/* Match otherwise-unmatched unicast packets */
|
||||
EFX_FILTER_MATCH_UNKNOWN_UCAST_DST = 0x80000000,
|
||||
} efx_filter_match_flags_t;
|
||||
|
||||
typedef enum efx_filter_priority_s {
|
||||
@ -2234,7 +2234,7 @@ typedef enum efx_filter_priority_s {
|
||||
*/
|
||||
|
||||
typedef struct efx_filter_spec_s {
|
||||
uint32_t efs_match_flags:12;
|
||||
uint32_t efs_match_flags;
|
||||
uint32_t efs_priority:2;
|
||||
uint32_t efs_flags:6;
|
||||
uint32_t efs_dmaq_id:12;
|
||||
|
@ -152,9 +152,6 @@ efx_filter_init(
|
||||
const efx_filter_ops_t *efop;
|
||||
efx_rc_t rc;
|
||||
|
||||
/* Check that efx_filter_spec_t is 64 bytes. */
|
||||
EFX_STATIC_ASSERT(sizeof (efx_filter_spec_t) == 64);
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_FILTER));
|
||||
@ -390,7 +387,7 @@ efx_filter_spec_set_uc_def(
|
||||
{
|
||||
EFSYS_ASSERT3P(spec, !=, NULL);
|
||||
|
||||
spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG;
|
||||
spec->efs_match_flags |= EFX_FILTER_MATCH_UNKNOWN_UCAST_DST;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -403,8 +400,7 @@ efx_filter_spec_set_mc_def(
|
||||
{
|
||||
EFSYS_ASSERT3P(spec, !=, NULL);
|
||||
|
||||
spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG;
|
||||
spec->efs_loc_mac[0] = 1;
|
||||
spec->efs_match_flags |= EFX_FILTER_MATCH_UNKNOWN_MCAST_DST;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user