sfxge(4): rename falconsiena_filter types
Falcon support has been removed, so this code only supports Siena. Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6342
This commit is contained in:
parent
bebd526933
commit
f7aa4b3d07
@ -429,7 +429,7 @@ efx_filter_spec_set_mc_def(
|
||||
|
||||
static __checkReturn efx_rc_t
|
||||
siena_filter_spec_from_gen_spec(
|
||||
__out falconsiena_filter_spec_t *fs_spec,
|
||||
__out siena_filter_spec_t *sf_spec,
|
||||
__in efx_filter_spec_t *gen_spec)
|
||||
{
|
||||
efx_rc_t rc;
|
||||
@ -447,8 +447,8 @@ siena_filter_spec_from_gen_spec(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
fs_spec->fsfs_flags = gen_spec->efs_flags;
|
||||
fs_spec->fsfs_dmaq_id = gen_spec->efs_dmaq_id;
|
||||
sf_spec->sfs_flags = gen_spec->efs_flags;
|
||||
sf_spec->sfs_dmaq_id = gen_spec->efs_dmaq_id;
|
||||
|
||||
switch (gen_spec->efs_match_flags) {
|
||||
case EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
|
||||
@ -473,24 +473,24 @@ siena_filter_spec_from_gen_spec(
|
||||
switch (gen_spec->efs_ip_proto) {
|
||||
case EFX_IPPROTO_TCP:
|
||||
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_TX_TCP_FULL :
|
||||
EFX_FS_FILTER_TX_TCP_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_TX_TCP_FULL :
|
||||
EFX_SIENA_FILTER_TX_TCP_WILD);
|
||||
} else {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_RX_TCP_FULL :
|
||||
EFX_FS_FILTER_RX_TCP_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_RX_TCP_FULL :
|
||||
EFX_SIENA_FILTER_RX_TCP_WILD);
|
||||
}
|
||||
break;
|
||||
case EFX_IPPROTO_UDP:
|
||||
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_TX_UDP_FULL :
|
||||
EFX_FS_FILTER_TX_UDP_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_TX_UDP_FULL :
|
||||
EFX_SIENA_FILTER_TX_UDP_WILD);
|
||||
} else {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_RX_UDP_FULL :
|
||||
EFX_FS_FILTER_RX_UDP_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_RX_UDP_FULL :
|
||||
EFX_SIENA_FILTER_RX_UDP_WILD);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -513,7 +513,8 @@ siena_filter_spec_from_gen_spec(
|
||||
host2 = gen_spec->efs_loc_host.eo_u32[0];
|
||||
}
|
||||
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
|
||||
if (fs_spec->fsfs_type == EFX_FS_FILTER_TX_UDP_WILD) {
|
||||
if (sf_spec->sfs_type ==
|
||||
EFX_SIENA_FILTER_TX_UDP_WILD) {
|
||||
port1 = rport;
|
||||
port2 = gen_spec->efs_loc_port;
|
||||
} else {
|
||||
@ -521,7 +522,8 @@ siena_filter_spec_from_gen_spec(
|
||||
port2 = rport;
|
||||
}
|
||||
} else {
|
||||
if (fs_spec->fsfs_type == EFX_FS_FILTER_RX_UDP_WILD) {
|
||||
if (sf_spec->sfs_type ==
|
||||
EFX_SIENA_FILTER_RX_UDP_WILD) {
|
||||
port1 = gen_spec->efs_loc_port;
|
||||
port2 = rport;
|
||||
} else {
|
||||
@ -529,9 +531,9 @@ siena_filter_spec_from_gen_spec(
|
||||
port2 = gen_spec->efs_loc_port;
|
||||
}
|
||||
}
|
||||
fs_spec->fsfs_dword[0] = (host1 << 16) | port1;
|
||||
fs_spec->fsfs_dword[1] = (port2 << 16) | (host1 >> 16);
|
||||
fs_spec->fsfs_dword[2] = host2;
|
||||
sf_spec->sfs_dword[0] = (host1 << 16) | port1;
|
||||
sf_spec->sfs_dword[1] = (port2 << 16) | (host1 >> 16);
|
||||
sf_spec->sfs_dword[2] = host2;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -540,21 +542,21 @@ siena_filter_spec_from_gen_spec(
|
||||
/* Fall through */
|
||||
case EFX_FILTER_MATCH_LOC_MAC:
|
||||
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_TX_MAC_FULL :
|
||||
EFX_FS_FILTER_TX_MAC_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_TX_MAC_FULL :
|
||||
EFX_SIENA_FILTER_TX_MAC_WILD);
|
||||
} else {
|
||||
fs_spec->fsfs_type = (is_full ?
|
||||
EFX_FS_FILTER_RX_MAC_FULL :
|
||||
EFX_FS_FILTER_RX_MAC_WILD);
|
||||
sf_spec->sfs_type = (is_full ?
|
||||
EFX_SIENA_FILTER_RX_MAC_FULL :
|
||||
EFX_SIENA_FILTER_RX_MAC_WILD);
|
||||
}
|
||||
fs_spec->fsfs_dword[0] = is_full ? gen_spec->efs_outer_vid : 0;
|
||||
fs_spec->fsfs_dword[1] =
|
||||
sf_spec->sfs_dword[0] = is_full ? gen_spec->efs_outer_vid : 0;
|
||||
sf_spec->sfs_dword[1] =
|
||||
gen_spec->efs_loc_mac[2] << 24 |
|
||||
gen_spec->efs_loc_mac[3] << 16 |
|
||||
gen_spec->efs_loc_mac[4] << 8 |
|
||||
gen_spec->efs_loc_mac[5];
|
||||
fs_spec->fsfs_dword[2] =
|
||||
sf_spec->sfs_dword[2] =
|
||||
gen_spec->efs_loc_mac[0] << 8 |
|
||||
gen_spec->efs_loc_mac[1];
|
||||
break;
|
||||
@ -617,70 +619,70 @@ siena_filter_tbl_increment(
|
||||
|
||||
static __checkReturn boolean_t
|
||||
siena_filter_test_used(
|
||||
__in falconsiena_filter_tbl_t *fsftp,
|
||||
__in siena_filter_tbl_t *sftp,
|
||||
__in unsigned int index)
|
||||
{
|
||||
EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
|
||||
return ((fsftp->fsft_bitmap[index / 32] & (1 << (index % 32))) != 0);
|
||||
EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
|
||||
return ((sftp->sft_bitmap[index / 32] & (1 << (index % 32))) != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
siena_filter_set_used(
|
||||
__in falconsiena_filter_tbl_t *fsftp,
|
||||
__in siena_filter_tbl_t *sftp,
|
||||
__in unsigned int index)
|
||||
{
|
||||
EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
|
||||
fsftp->fsft_bitmap[index / 32] |= (1 << (index % 32));
|
||||
++fsftp->fsft_used;
|
||||
EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
|
||||
sftp->sft_bitmap[index / 32] |= (1 << (index % 32));
|
||||
++sftp->sft_used;
|
||||
}
|
||||
|
||||
static void
|
||||
siena_filter_clear_used(
|
||||
__in falconsiena_filter_tbl_t *fsftp,
|
||||
__in siena_filter_tbl_t *sftp,
|
||||
__in unsigned int index)
|
||||
{
|
||||
EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
|
||||
fsftp->fsft_bitmap[index / 32] &= ~(1 << (index % 32));
|
||||
EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
|
||||
sftp->sft_bitmap[index / 32] &= ~(1 << (index % 32));
|
||||
|
||||
--fsftp->fsft_used;
|
||||
EFSYS_ASSERT3U(fsftp->fsft_used, >=, 0);
|
||||
--sftp->sft_used;
|
||||
EFSYS_ASSERT3U(sftp->sft_used, >=, 0);
|
||||
}
|
||||
|
||||
|
||||
static falconsiena_filter_tbl_id_t
|
||||
static siena_filter_tbl_id_t
|
||||
siena_filter_tbl_id(
|
||||
__in falconsiena_filter_type_t type)
|
||||
__in siena_filter_type_t type)
|
||||
{
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
|
||||
switch (type) {
|
||||
case EFX_FS_FILTER_RX_TCP_FULL:
|
||||
case EFX_FS_FILTER_RX_TCP_WILD:
|
||||
case EFX_FS_FILTER_RX_UDP_FULL:
|
||||
case EFX_FS_FILTER_RX_UDP_WILD:
|
||||
tbl_id = EFX_FS_FILTER_TBL_RX_IP;
|
||||
case EFX_SIENA_FILTER_RX_TCP_FULL:
|
||||
case EFX_SIENA_FILTER_RX_TCP_WILD:
|
||||
case EFX_SIENA_FILTER_RX_UDP_FULL:
|
||||
case EFX_SIENA_FILTER_RX_UDP_WILD:
|
||||
tbl_id = EFX_SIENA_FILTER_TBL_RX_IP;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_RX_MAC_FULL:
|
||||
case EFX_FS_FILTER_RX_MAC_WILD:
|
||||
tbl_id = EFX_FS_FILTER_TBL_RX_MAC;
|
||||
case EFX_SIENA_FILTER_RX_MAC_FULL:
|
||||
case EFX_SIENA_FILTER_RX_MAC_WILD:
|
||||
tbl_id = EFX_SIENA_FILTER_TBL_RX_MAC;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TX_TCP_FULL:
|
||||
case EFX_FS_FILTER_TX_TCP_WILD:
|
||||
case EFX_FS_FILTER_TX_UDP_FULL:
|
||||
case EFX_FS_FILTER_TX_UDP_WILD:
|
||||
tbl_id = EFX_FS_FILTER_TBL_TX_IP;
|
||||
case EFX_SIENA_FILTER_TX_TCP_FULL:
|
||||
case EFX_SIENA_FILTER_TX_TCP_WILD:
|
||||
case EFX_SIENA_FILTER_TX_UDP_FULL:
|
||||
case EFX_SIENA_FILTER_TX_UDP_WILD:
|
||||
tbl_id = EFX_SIENA_FILTER_TBL_TX_IP;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TX_MAC_FULL:
|
||||
case EFX_FS_FILTER_TX_MAC_WILD:
|
||||
tbl_id = EFX_FS_FILTER_TBL_TX_MAC;
|
||||
case EFX_SIENA_FILTER_TX_MAC_FULL:
|
||||
case EFX_SIENA_FILTER_TX_MAC_WILD:
|
||||
tbl_id = EFX_SIENA_FILTER_TBL_TX_MAC;
|
||||
break;
|
||||
|
||||
default:
|
||||
EFSYS_ASSERT(B_FALSE);
|
||||
tbl_id = EFX_FS_FILTER_NTBLS;
|
||||
tbl_id = EFX_SIENA_FILTER_NTBLS;
|
||||
break;
|
||||
}
|
||||
return (tbl_id);
|
||||
@ -688,32 +690,32 @@ siena_filter_tbl_id(
|
||||
|
||||
static void
|
||||
siena_filter_reset_search_depth(
|
||||
__inout falconsiena_filter_t *fsfp,
|
||||
__in falconsiena_filter_tbl_id_t tbl_id)
|
||||
__inout siena_filter_t *sfp,
|
||||
__in siena_filter_tbl_id_t tbl_id)
|
||||
{
|
||||
switch (tbl_id) {
|
||||
case EFX_FS_FILTER_TBL_RX_IP:
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_WILD] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_WILD] = 0;
|
||||
case EFX_SIENA_FILTER_TBL_RX_IP:
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_WILD] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_WILD] = 0;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TBL_RX_MAC:
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_WILD] = 0;
|
||||
case EFX_SIENA_FILTER_TBL_RX_MAC:
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_WILD] = 0;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TBL_TX_IP:
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_WILD] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_WILD] = 0;
|
||||
case EFX_SIENA_FILTER_TBL_TX_IP:
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_WILD] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_WILD] = 0;
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TBL_TX_MAC:
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_FULL] = 0;
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_WILD] = 0;
|
||||
case EFX_SIENA_FILTER_TBL_TX_MAC:
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_FULL] = 0;
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_WILD] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -726,32 +728,32 @@ static void
|
||||
siena_filter_push_rx_limits(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
efx_oword_t oword;
|
||||
|
||||
EFX_BAR_READO(enp, FR_AZ_RX_FILTER_CTL_REG, &oword);
|
||||
|
||||
EFX_SET_OWORD_FIELD(oword, FRF_AZ_TCP_FULL_SRCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(oword, FRF_AZ_TCP_WILD_SRCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
EFX_SET_OWORD_FIELD(oword, FRF_AZ_UDP_FULL_SRCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(oword, FRF_AZ_UDP_WILD_SRCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
|
||||
if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_MAC].fsft_size) {
|
||||
if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_MAC].sft_size) {
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_ETHERNET_FULL_SEARCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_ETHERNET_WILDCARD_SEARCH_LIMIT,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
}
|
||||
|
||||
@ -762,38 +764,38 @@ static void
|
||||
siena_filter_push_tx_limits(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
efx_oword_t oword;
|
||||
|
||||
EFX_BAR_READO(enp, FR_AZ_TX_CFG_REG, &oword);
|
||||
|
||||
if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_IP].fsft_size != 0) {
|
||||
if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_IP].sft_size != 0) {
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_TX_TCPIP_FILTER_FULL_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_TX_TCPIP_FILTER_WILD_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_TX_UDPIP_FILTER_FULL_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(oword,
|
||||
FRF_CZ_TX_UDPIP_FILTER_WILD_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
}
|
||||
|
||||
if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_MAC].fsft_size != 0) {
|
||||
if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_MAC].sft_size != 0) {
|
||||
EFX_SET_OWORD_FIELD(
|
||||
oword, FRF_CZ_TX_ETH_FILTER_FULL_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_FULL] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_FULL] +
|
||||
FILTER_CTL_SRCH_FUDGE_FULL);
|
||||
EFX_SET_OWORD_FIELD(
|
||||
oword, FRF_CZ_TX_ETH_FILTER_WILD_SEARCH_RANGE,
|
||||
fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_WILD] +
|
||||
sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_WILD] +
|
||||
FILTER_CTL_SRCH_FUDGE_WILD);
|
||||
}
|
||||
|
||||
@ -804,69 +806,69 @@ siena_filter_push_tx_limits(
|
||||
static __checkReturn uint32_t
|
||||
siena_filter_build(
|
||||
__out efx_oword_t *filter,
|
||||
__in falconsiena_filter_spec_t *spec)
|
||||
__in siena_filter_spec_t *spec)
|
||||
{
|
||||
uint32_t dword3;
|
||||
uint32_t key;
|
||||
uint8_t type = spec->fsfs_type;
|
||||
uint32_t flags = spec->fsfs_flags;
|
||||
uint8_t type = spec->sfs_type;
|
||||
uint32_t flags = spec->sfs_flags;
|
||||
|
||||
switch (siena_filter_tbl_id(type)) {
|
||||
case EFX_FS_FILTER_TBL_RX_IP: {
|
||||
boolean_t is_udp = (type == EFX_FS_FILTER_RX_UDP_FULL ||
|
||||
type == EFX_FS_FILTER_RX_UDP_WILD);
|
||||
case EFX_SIENA_FILTER_TBL_RX_IP: {
|
||||
boolean_t is_udp = (type == EFX_SIENA_FILTER_RX_UDP_FULL ||
|
||||
type == EFX_SIENA_FILTER_RX_UDP_WILD);
|
||||
EFX_POPULATE_OWORD_7(*filter,
|
||||
FRF_BZ_RSS_EN,
|
||||
(flags & EFX_FILTER_FLAG_RX_RSS) ? 1 : 0,
|
||||
FRF_BZ_SCATTER_EN,
|
||||
(flags & EFX_FILTER_FLAG_RX_SCATTER) ? 1 : 0,
|
||||
FRF_AZ_TCP_UDP, is_udp,
|
||||
FRF_AZ_RXQ_ID, spec->fsfs_dmaq_id,
|
||||
EFX_DWORD_2, spec->fsfs_dword[2],
|
||||
EFX_DWORD_1, spec->fsfs_dword[1],
|
||||
EFX_DWORD_0, spec->fsfs_dword[0]);
|
||||
FRF_AZ_RXQ_ID, spec->sfs_dmaq_id,
|
||||
EFX_DWORD_2, spec->sfs_dword[2],
|
||||
EFX_DWORD_1, spec->sfs_dword[1],
|
||||
EFX_DWORD_0, spec->sfs_dword[0]);
|
||||
dword3 = is_udp;
|
||||
break;
|
||||
}
|
||||
|
||||
case EFX_FS_FILTER_TBL_RX_MAC: {
|
||||
boolean_t is_wild = (type == EFX_FS_FILTER_RX_MAC_WILD);
|
||||
case EFX_SIENA_FILTER_TBL_RX_MAC: {
|
||||
boolean_t is_wild = (type == EFX_SIENA_FILTER_RX_MAC_WILD);
|
||||
EFX_POPULATE_OWORD_7(*filter,
|
||||
FRF_CZ_RMFT_RSS_EN,
|
||||
(flags & EFX_FILTER_FLAG_RX_RSS) ? 1 : 0,
|
||||
FRF_CZ_RMFT_SCATTER_EN,
|
||||
(flags & EFX_FILTER_FLAG_RX_SCATTER) ? 1 : 0,
|
||||
FRF_CZ_RMFT_RXQ_ID, spec->fsfs_dmaq_id,
|
||||
FRF_CZ_RMFT_RXQ_ID, spec->sfs_dmaq_id,
|
||||
FRF_CZ_RMFT_WILDCARD_MATCH, is_wild,
|
||||
FRF_CZ_RMFT_DEST_MAC_DW1, spec->fsfs_dword[2],
|
||||
FRF_CZ_RMFT_DEST_MAC_DW0, spec->fsfs_dword[1],
|
||||
FRF_CZ_RMFT_VLAN_ID, spec->fsfs_dword[0]);
|
||||
FRF_CZ_RMFT_DEST_MAC_DW1, spec->sfs_dword[2],
|
||||
FRF_CZ_RMFT_DEST_MAC_DW0, spec->sfs_dword[1],
|
||||
FRF_CZ_RMFT_VLAN_ID, spec->sfs_dword[0]);
|
||||
dword3 = is_wild;
|
||||
break;
|
||||
}
|
||||
|
||||
case EFX_FS_FILTER_TBL_TX_IP: {
|
||||
boolean_t is_udp = (type == EFX_FS_FILTER_TX_UDP_FULL ||
|
||||
type == EFX_FS_FILTER_TX_UDP_WILD);
|
||||
case EFX_SIENA_FILTER_TBL_TX_IP: {
|
||||
boolean_t is_udp = (type == EFX_SIENA_FILTER_TX_UDP_FULL ||
|
||||
type == EFX_SIENA_FILTER_TX_UDP_WILD);
|
||||
EFX_POPULATE_OWORD_5(*filter,
|
||||
FRF_CZ_TIFT_TCP_UDP, is_udp,
|
||||
FRF_CZ_TIFT_TXQ_ID, spec->fsfs_dmaq_id,
|
||||
EFX_DWORD_2, spec->fsfs_dword[2],
|
||||
EFX_DWORD_1, spec->fsfs_dword[1],
|
||||
EFX_DWORD_0, spec->fsfs_dword[0]);
|
||||
dword3 = is_udp | spec->fsfs_dmaq_id << 1;
|
||||
FRF_CZ_TIFT_TXQ_ID, spec->sfs_dmaq_id,
|
||||
EFX_DWORD_2, spec->sfs_dword[2],
|
||||
EFX_DWORD_1, spec->sfs_dword[1],
|
||||
EFX_DWORD_0, spec->sfs_dword[0]);
|
||||
dword3 = is_udp | spec->sfs_dmaq_id << 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case EFX_FS_FILTER_TBL_TX_MAC: {
|
||||
boolean_t is_wild = (type == EFX_FS_FILTER_TX_MAC_WILD);
|
||||
case EFX_SIENA_FILTER_TBL_TX_MAC: {
|
||||
boolean_t is_wild = (type == EFX_SIENA_FILTER_TX_MAC_WILD);
|
||||
EFX_POPULATE_OWORD_5(*filter,
|
||||
FRF_CZ_TMFT_TXQ_ID, spec->fsfs_dmaq_id,
|
||||
FRF_CZ_TMFT_TXQ_ID, spec->sfs_dmaq_id,
|
||||
FRF_CZ_TMFT_WILDCARD_MATCH, is_wild,
|
||||
FRF_CZ_TMFT_SRC_MAC_DW1, spec->fsfs_dword[2],
|
||||
FRF_CZ_TMFT_SRC_MAC_DW0, spec->fsfs_dword[1],
|
||||
FRF_CZ_TMFT_VLAN_ID, spec->fsfs_dword[0]);
|
||||
dword3 = is_wild | spec->fsfs_dmaq_id << 1;
|
||||
FRF_CZ_TMFT_SRC_MAC_DW1, spec->sfs_dword[2],
|
||||
FRF_CZ_TMFT_SRC_MAC_DW0, spec->sfs_dword[1],
|
||||
FRF_CZ_TMFT_VLAN_ID, spec->sfs_dword[0]);
|
||||
dword3 = is_wild | spec->sfs_dmaq_id << 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -876,9 +878,9 @@ siena_filter_build(
|
||||
}
|
||||
|
||||
key =
|
||||
spec->fsfs_dword[0] ^
|
||||
spec->fsfs_dword[1] ^
|
||||
spec->fsfs_dword[2] ^
|
||||
spec->sfs_dword[0] ^
|
||||
spec->sfs_dword[1] ^
|
||||
spec->sfs_dword[2] ^
|
||||
dword3;
|
||||
|
||||
return (key);
|
||||
@ -887,37 +889,37 @@ siena_filter_build(
|
||||
static __checkReturn efx_rc_t
|
||||
siena_filter_push_entry(
|
||||
__inout efx_nic_t *enp,
|
||||
__in falconsiena_filter_type_t type,
|
||||
__in siena_filter_type_t type,
|
||||
__in int index,
|
||||
__in efx_oword_t *eop)
|
||||
{
|
||||
efx_rc_t rc;
|
||||
|
||||
switch (type) {
|
||||
case EFX_FS_FILTER_RX_TCP_FULL:
|
||||
case EFX_FS_FILTER_RX_TCP_WILD:
|
||||
case EFX_FS_FILTER_RX_UDP_FULL:
|
||||
case EFX_FS_FILTER_RX_UDP_WILD:
|
||||
case EFX_SIENA_FILTER_RX_TCP_FULL:
|
||||
case EFX_SIENA_FILTER_RX_TCP_WILD:
|
||||
case EFX_SIENA_FILTER_RX_UDP_FULL:
|
||||
case EFX_SIENA_FILTER_RX_UDP_WILD:
|
||||
EFX_BAR_TBL_WRITEO(enp, FR_AZ_RX_FILTER_TBL0, index,
|
||||
eop, B_TRUE);
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_RX_MAC_FULL:
|
||||
case EFX_FS_FILTER_RX_MAC_WILD:
|
||||
case EFX_SIENA_FILTER_RX_MAC_FULL:
|
||||
case EFX_SIENA_FILTER_RX_MAC_WILD:
|
||||
EFX_BAR_TBL_WRITEO(enp, FR_CZ_RX_MAC_FILTER_TBL0, index,
|
||||
eop, B_TRUE);
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TX_TCP_FULL:
|
||||
case EFX_FS_FILTER_TX_TCP_WILD:
|
||||
case EFX_FS_FILTER_TX_UDP_FULL:
|
||||
case EFX_FS_FILTER_TX_UDP_WILD:
|
||||
case EFX_SIENA_FILTER_TX_TCP_FULL:
|
||||
case EFX_SIENA_FILTER_TX_TCP_WILD:
|
||||
case EFX_SIENA_FILTER_TX_UDP_FULL:
|
||||
case EFX_SIENA_FILTER_TX_UDP_WILD:
|
||||
EFX_BAR_TBL_WRITEO(enp, FR_CZ_TX_FILTER_TBL0, index,
|
||||
eop, B_TRUE);
|
||||
break;
|
||||
|
||||
case EFX_FS_FILTER_TX_MAC_FULL:
|
||||
case EFX_FS_FILTER_TX_MAC_WILD:
|
||||
case EFX_SIENA_FILTER_TX_MAC_FULL:
|
||||
case EFX_SIENA_FILTER_TX_MAC_WILD:
|
||||
EFX_BAR_TBL_WRITEO(enp, FR_CZ_TX_MAC_FILTER_TBL0, index,
|
||||
eop, B_TRUE);
|
||||
break;
|
||||
@ -936,24 +938,24 @@ siena_filter_push_entry(
|
||||
|
||||
static __checkReturn boolean_t
|
||||
siena_filter_equal(
|
||||
__in const falconsiena_filter_spec_t *left,
|
||||
__in const falconsiena_filter_spec_t *right)
|
||||
__in const siena_filter_spec_t *left,
|
||||
__in const siena_filter_spec_t *right)
|
||||
{
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
|
||||
tbl_id = siena_filter_tbl_id(left->fsfs_type);
|
||||
tbl_id = siena_filter_tbl_id(left->sfs_type);
|
||||
|
||||
|
||||
if (left->fsfs_type != right->fsfs_type)
|
||||
if (left->sfs_type != right->sfs_type)
|
||||
return (B_FALSE);
|
||||
|
||||
if (memcmp(left->fsfs_dword, right->fsfs_dword,
|
||||
sizeof (left->fsfs_dword)))
|
||||
if (memcmp(left->sfs_dword, right->sfs_dword,
|
||||
sizeof (left->sfs_dword)))
|
||||
return (B_FALSE);
|
||||
|
||||
if ((tbl_id == EFX_FS_FILTER_TBL_TX_IP ||
|
||||
tbl_id == EFX_FS_FILTER_TBL_TX_MAC) &&
|
||||
left->fsfs_dmaq_id != right->fsfs_dmaq_id)
|
||||
if ((tbl_id == EFX_SIENA_FILTER_TBL_TX_IP ||
|
||||
tbl_id == EFX_SIENA_FILTER_TBL_TX_MAC) &&
|
||||
left->sfs_dmaq_id != right->sfs_dmaq_id)
|
||||
return (B_FALSE);
|
||||
|
||||
return (B_TRUE);
|
||||
@ -961,8 +963,8 @@ siena_filter_equal(
|
||||
|
||||
static __checkReturn efx_rc_t
|
||||
siena_filter_search(
|
||||
__in falconsiena_filter_tbl_t *fsftp,
|
||||
__in falconsiena_filter_spec_t *spec,
|
||||
__in siena_filter_tbl_t *sftp,
|
||||
__in siena_filter_spec_t *spec,
|
||||
__in uint32_t key,
|
||||
__in boolean_t for_insert,
|
||||
__out int *filter_index,
|
||||
@ -973,7 +975,7 @@ siena_filter_search(
|
||||
hash = siena_filter_tbl_hash(key);
|
||||
incr = siena_filter_tbl_increment(key);
|
||||
|
||||
filter_idx = hash & (fsftp->fsft_size - 1);
|
||||
filter_idx = hash & (sftp->sft_size - 1);
|
||||
depth = 1;
|
||||
|
||||
for (;;) {
|
||||
@ -981,9 +983,9 @@ siena_filter_search(
|
||||
* Return success if entry is used and matches this spec
|
||||
* or entry is unused and we are trying to insert.
|
||||
*/
|
||||
if (siena_filter_test_used(fsftp, filter_idx) ?
|
||||
if (siena_filter_test_used(sftp, filter_idx) ?
|
||||
siena_filter_equal(spec,
|
||||
&fsftp->fsft_spec[filter_idx]) :
|
||||
&sftp->sft_spec[filter_idx]) :
|
||||
for_insert) {
|
||||
*filter_index = filter_idx;
|
||||
*depth_required = depth;
|
||||
@ -994,7 +996,7 @@ siena_filter_search(
|
||||
if (depth == FILTER_CTL_SRCH_MAX)
|
||||
return (for_insert ? EBUSY : ENOENT);
|
||||
|
||||
filter_idx = (filter_idx + incr) & (fsftp->fsft_size - 1);
|
||||
filter_idx = (filter_idx + incr) & (sftp->sft_size - 1);
|
||||
++depth;
|
||||
}
|
||||
}
|
||||
@ -1002,42 +1004,42 @@ siena_filter_search(
|
||||
static void
|
||||
siena_filter_clear_entry(
|
||||
__in efx_nic_t *enp,
|
||||
__in falconsiena_filter_tbl_t *fsftp,
|
||||
__in siena_filter_tbl_t *sftp,
|
||||
__in int index)
|
||||
{
|
||||
efx_oword_t filter;
|
||||
|
||||
if (siena_filter_test_used(fsftp, index)) {
|
||||
siena_filter_clear_used(fsftp, index);
|
||||
if (siena_filter_test_used(sftp, index)) {
|
||||
siena_filter_clear_used(sftp, index);
|
||||
|
||||
EFX_ZERO_OWORD(filter);
|
||||
siena_filter_push_entry(enp,
|
||||
fsftp->fsft_spec[index].fsfs_type,
|
||||
sftp->sft_spec[index].sfs_type,
|
||||
index, &filter);
|
||||
|
||||
memset(&fsftp->fsft_spec[index],
|
||||
0, sizeof (fsftp->fsft_spec[0]));
|
||||
memset(&sftp->sft_spec[index],
|
||||
0, sizeof (sftp->sft_spec[0]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
siena_filter_tbl_clear(
|
||||
__in efx_nic_t *enp,
|
||||
__in falconsiena_filter_tbl_id_t tbl_id)
|
||||
__in siena_filter_tbl_id_t tbl_id)
|
||||
{
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
falconsiena_filter_tbl_t *fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id];
|
||||
int index;
|
||||
int state;
|
||||
|
||||
EFSYS_LOCK(enp->en_eslp, state);
|
||||
|
||||
for (index = 0; index < fsftp->fsft_size; ++index) {
|
||||
siena_filter_clear_entry(enp, fsftp, index);
|
||||
for (index = 0; index < sftp->sft_size; ++index) {
|
||||
siena_filter_clear_entry(enp, sftp, index);
|
||||
}
|
||||
|
||||
if (fsftp->fsft_used == 0)
|
||||
siena_filter_reset_search_depth(fsfp, tbl_id);
|
||||
if (sftp->sft_used == 0)
|
||||
siena_filter_reset_search_depth(sfp, tbl_id);
|
||||
|
||||
EFSYS_UNLOCK(enp->en_eslp, state);
|
||||
}
|
||||
@ -1046,33 +1048,33 @@ static __checkReturn efx_rc_t
|
||||
siena_filter_init(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
falconsiena_filter_t *fsfp;
|
||||
falconsiena_filter_tbl_t *fsftp;
|
||||
siena_filter_t *sfp;
|
||||
siena_filter_tbl_t *sftp;
|
||||
int tbl_id;
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (falconsiena_filter_t), fsfp);
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (siena_filter_t), sfp);
|
||||
|
||||
if (!fsfp) {
|
||||
if (!sfp) {
|
||||
rc = ENOMEM;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
enp->en_filter.ef_falconsiena_filter = fsfp;
|
||||
enp->en_filter.ef_siena_filter = sfp;
|
||||
|
||||
switch (enp->en_family) {
|
||||
case EFX_FAMILY_SIENA:
|
||||
fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_IP];
|
||||
fsftp->fsft_size = FR_AZ_RX_FILTER_TBL0_ROWS;
|
||||
sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_IP];
|
||||
sftp->sft_size = FR_AZ_RX_FILTER_TBL0_ROWS;
|
||||
|
||||
fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_MAC];
|
||||
fsftp->fsft_size = FR_CZ_RX_MAC_FILTER_TBL0_ROWS;
|
||||
sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_MAC];
|
||||
sftp->sft_size = FR_CZ_RX_MAC_FILTER_TBL0_ROWS;
|
||||
|
||||
fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_IP];
|
||||
fsftp->fsft_size = FR_CZ_TX_FILTER_TBL0_ROWS;
|
||||
sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_IP];
|
||||
sftp->sft_size = FR_CZ_TX_FILTER_TBL0_ROWS;
|
||||
|
||||
fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_MAC];
|
||||
fsftp->fsft_size = FR_CZ_TX_MAC_FILTER_TBL0_ROWS;
|
||||
sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_MAC];
|
||||
sftp->sft_size = FR_CZ_TX_MAC_FILTER_TBL0_ROWS;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1080,33 +1082,33 @@ siena_filter_init(
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
|
||||
for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
|
||||
unsigned int bitmap_size;
|
||||
|
||||
fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
if (fsftp->fsft_size == 0)
|
||||
sftp = &sfp->sf_tbl[tbl_id];
|
||||
if (sftp->sft_size == 0)
|
||||
continue;
|
||||
|
||||
EFX_STATIC_ASSERT(sizeof (fsftp->fsft_bitmap[0]) ==
|
||||
EFX_STATIC_ASSERT(sizeof (sftp->sft_bitmap[0]) ==
|
||||
sizeof (uint32_t));
|
||||
bitmap_size =
|
||||
(fsftp->fsft_size + (sizeof (uint32_t) * 8) - 1) / 8;
|
||||
(sftp->sft_size + (sizeof (uint32_t) * 8) - 1) / 8;
|
||||
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, bitmap_size, fsftp->fsft_bitmap);
|
||||
if (!fsftp->fsft_bitmap) {
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip, bitmap_size, sftp->sft_bitmap);
|
||||
if (!sftp->sft_bitmap) {
|
||||
rc = ENOMEM;
|
||||
goto fail3;
|
||||
}
|
||||
|
||||
EFSYS_KMEM_ALLOC(enp->en_esip,
|
||||
fsftp->fsft_size * sizeof (*fsftp->fsft_spec),
|
||||
fsftp->fsft_spec);
|
||||
if (!fsftp->fsft_spec) {
|
||||
sftp->sft_size * sizeof (*sftp->sft_spec),
|
||||
sftp->sft_spec);
|
||||
if (!sftp->sft_spec) {
|
||||
rc = ENOMEM;
|
||||
goto fail4;
|
||||
}
|
||||
memset(fsftp->fsft_spec, 0,
|
||||
fsftp->fsft_size * sizeof (*fsftp->fsft_spec));
|
||||
memset(sftp->sft_spec, 0,
|
||||
sftp->sft_size * sizeof (*sftp->sft_spec));
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -1130,39 +1132,39 @@ static void
|
||||
siena_filter_fini(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
|
||||
|
||||
if (fsfp == NULL)
|
||||
if (sfp == NULL)
|
||||
return;
|
||||
|
||||
for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
|
||||
falconsiena_filter_tbl_t *fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
|
||||
siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id];
|
||||
unsigned int bitmap_size;
|
||||
|
||||
EFX_STATIC_ASSERT(sizeof (fsftp->fsft_bitmap[0]) ==
|
||||
EFX_STATIC_ASSERT(sizeof (sftp->sft_bitmap[0]) ==
|
||||
sizeof (uint32_t));
|
||||
bitmap_size =
|
||||
(fsftp->fsft_size + (sizeof (uint32_t) * 8) - 1) / 8;
|
||||
(sftp->sft_size + (sizeof (uint32_t) * 8) - 1) / 8;
|
||||
|
||||
if (fsftp->fsft_bitmap != NULL) {
|
||||
if (sftp->sft_bitmap != NULL) {
|
||||
EFSYS_KMEM_FREE(enp->en_esip, bitmap_size,
|
||||
fsftp->fsft_bitmap);
|
||||
fsftp->fsft_bitmap = NULL;
|
||||
sftp->sft_bitmap);
|
||||
sftp->sft_bitmap = NULL;
|
||||
}
|
||||
|
||||
if (fsftp->fsft_spec != NULL) {
|
||||
EFSYS_KMEM_FREE(enp->en_esip, fsftp->fsft_size *
|
||||
sizeof (*fsftp->fsft_spec), fsftp->fsft_spec);
|
||||
fsftp->fsft_spec = NULL;
|
||||
if (sftp->sft_spec != NULL) {
|
||||
EFSYS_KMEM_FREE(enp->en_esip, sftp->sft_size *
|
||||
sizeof (*sftp->sft_spec), sftp->sft_spec);
|
||||
sftp->sft_spec = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EFSYS_KMEM_FREE(enp->en_esip, sizeof (falconsiena_filter_t),
|
||||
enp->en_filter.ef_falconsiena_filter);
|
||||
EFSYS_KMEM_FREE(enp->en_esip, sizeof (siena_filter_t),
|
||||
enp->en_filter.ef_siena_filter);
|
||||
}
|
||||
|
||||
/* Restore filter state after a reset */
|
||||
@ -1170,10 +1172,10 @@ static __checkReturn efx_rc_t
|
||||
siena_filter_restore(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
falconsiena_filter_tbl_t *fsftp;
|
||||
falconsiena_filter_spec_t *spec;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_tbl_t *sftp;
|
||||
siena_filter_spec_t *spec;
|
||||
efx_oword_t filter;
|
||||
int filter_idx;
|
||||
int state;
|
||||
@ -1181,19 +1183,19 @@ siena_filter_restore(
|
||||
|
||||
EFSYS_LOCK(enp->en_eslp, state);
|
||||
|
||||
for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
|
||||
fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
|
||||
sftp = &sfp->sf_tbl[tbl_id];
|
||||
for (filter_idx = 0;
|
||||
filter_idx < fsftp->fsft_size;
|
||||
filter_idx < sftp->sft_size;
|
||||
filter_idx++) {
|
||||
if (!siena_filter_test_used(fsftp, filter_idx))
|
||||
if (!siena_filter_test_used(sftp, filter_idx))
|
||||
continue;
|
||||
|
||||
spec = &fsftp->fsft_spec[filter_idx];
|
||||
spec = &sftp->sft_spec[filter_idx];
|
||||
if ((rc = siena_filter_build(&filter, spec)) != 0)
|
||||
goto fail1;
|
||||
if ((rc = siena_filter_push_entry(enp,
|
||||
spec->fsfs_type, filter_idx, &filter)) != 0)
|
||||
spec->sfs_type, filter_idx, &filter)) != 0)
|
||||
goto fail2;
|
||||
}
|
||||
}
|
||||
@ -1223,11 +1225,11 @@ siena_filter_add(
|
||||
__in boolean_t may_replace)
|
||||
{
|
||||
efx_rc_t rc;
|
||||
falconsiena_filter_spec_t fs_spec;
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
falconsiena_filter_tbl_t *fsftp;
|
||||
falconsiena_filter_spec_t *saved_fs_spec;
|
||||
siena_filter_spec_t sf_spec;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_tbl_t *sftp;
|
||||
siena_filter_spec_t *saved_sf_spec;
|
||||
efx_oword_t filter;
|
||||
int filter_idx;
|
||||
unsigned int depth;
|
||||
@ -1237,48 +1239,48 @@ siena_filter_add(
|
||||
|
||||
EFSYS_ASSERT3P(spec, !=, NULL);
|
||||
|
||||
if ((rc = siena_filter_spec_from_gen_spec(&fs_spec, spec)) != 0)
|
||||
if ((rc = siena_filter_spec_from_gen_spec(&sf_spec, spec)) != 0)
|
||||
goto fail1;
|
||||
|
||||
tbl_id = siena_filter_tbl_id(fs_spec.fsfs_type);
|
||||
fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
tbl_id = siena_filter_tbl_id(sf_spec.sfs_type);
|
||||
sftp = &sfp->sf_tbl[tbl_id];
|
||||
|
||||
if (fsftp->fsft_size == 0) {
|
||||
if (sftp->sft_size == 0) {
|
||||
rc = EINVAL;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
key = siena_filter_build(&filter, &fs_spec);
|
||||
key = siena_filter_build(&filter, &sf_spec);
|
||||
|
||||
EFSYS_LOCK(enp->en_eslp, state);
|
||||
|
||||
rc = siena_filter_search(fsftp, &fs_spec, key, B_TRUE,
|
||||
rc = siena_filter_search(sftp, &sf_spec, key, B_TRUE,
|
||||
&filter_idx, &depth);
|
||||
if (rc != 0)
|
||||
goto fail3;
|
||||
|
||||
EFSYS_ASSERT3U(filter_idx, <, fsftp->fsft_size);
|
||||
saved_fs_spec = &fsftp->fsft_spec[filter_idx];
|
||||
EFSYS_ASSERT3U(filter_idx, <, sftp->sft_size);
|
||||
saved_sf_spec = &sftp->sft_spec[filter_idx];
|
||||
|
||||
if (siena_filter_test_used(fsftp, filter_idx)) {
|
||||
if (siena_filter_test_used(sftp, filter_idx)) {
|
||||
if (may_replace == B_FALSE) {
|
||||
rc = EEXIST;
|
||||
goto fail4;
|
||||
}
|
||||
}
|
||||
siena_filter_set_used(fsftp, filter_idx);
|
||||
*saved_fs_spec = fs_spec;
|
||||
siena_filter_set_used(sftp, filter_idx);
|
||||
*saved_sf_spec = sf_spec;
|
||||
|
||||
if (fsfp->fsf_depth[fs_spec.fsfs_type] < depth) {
|
||||
fsfp->fsf_depth[fs_spec.fsfs_type] = depth;
|
||||
if (tbl_id == EFX_FS_FILTER_TBL_TX_IP ||
|
||||
tbl_id == EFX_FS_FILTER_TBL_TX_MAC)
|
||||
if (sfp->sf_depth[sf_spec.sfs_type] < depth) {
|
||||
sfp->sf_depth[sf_spec.sfs_type] = depth;
|
||||
if (tbl_id == EFX_SIENA_FILTER_TBL_TX_IP ||
|
||||
tbl_id == EFX_SIENA_FILTER_TBL_TX_MAC)
|
||||
siena_filter_push_tx_limits(enp);
|
||||
else
|
||||
siena_filter_push_rx_limits(enp);
|
||||
}
|
||||
|
||||
siena_filter_push_entry(enp, fs_spec.fsfs_type,
|
||||
siena_filter_push_entry(enp, sf_spec.sfs_type,
|
||||
filter_idx, &filter);
|
||||
|
||||
EFSYS_UNLOCK(enp->en_eslp, state);
|
||||
@ -1305,10 +1307,10 @@ siena_filter_delete(
|
||||
__inout efx_filter_spec_t *spec)
|
||||
{
|
||||
efx_rc_t rc;
|
||||
falconsiena_filter_spec_t fs_spec;
|
||||
falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
|
||||
falconsiena_filter_tbl_id_t tbl_id;
|
||||
falconsiena_filter_tbl_t *fsftp;
|
||||
siena_filter_spec_t sf_spec;
|
||||
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
|
||||
siena_filter_tbl_id_t tbl_id;
|
||||
siena_filter_tbl_t *sftp;
|
||||
efx_oword_t filter;
|
||||
int filter_idx;
|
||||
unsigned int depth;
|
||||
@ -1317,24 +1319,24 @@ siena_filter_delete(
|
||||
|
||||
EFSYS_ASSERT3P(spec, !=, NULL);
|
||||
|
||||
if ((rc = siena_filter_spec_from_gen_spec(&fs_spec, spec)) != 0)
|
||||
if ((rc = siena_filter_spec_from_gen_spec(&sf_spec, spec)) != 0)
|
||||
goto fail1;
|
||||
|
||||
tbl_id = siena_filter_tbl_id(fs_spec.fsfs_type);
|
||||
fsftp = &fsfp->fsf_tbl[tbl_id];
|
||||
tbl_id = siena_filter_tbl_id(sf_spec.sfs_type);
|
||||
sftp = &sfp->sf_tbl[tbl_id];
|
||||
|
||||
key = siena_filter_build(&filter, &fs_spec);
|
||||
key = siena_filter_build(&filter, &sf_spec);
|
||||
|
||||
EFSYS_LOCK(enp->en_eslp, state);
|
||||
|
||||
rc = siena_filter_search(fsftp, &fs_spec, key, B_FALSE,
|
||||
rc = siena_filter_search(sftp, &sf_spec, key, B_FALSE,
|
||||
&filter_idx, &depth);
|
||||
if (rc != 0)
|
||||
goto fail2;
|
||||
|
||||
siena_filter_clear_entry(enp, fsftp, filter_idx);
|
||||
if (fsftp->fsft_used == 0)
|
||||
siena_filter_reset_search_depth(fsfp, tbl_id);
|
||||
siena_filter_clear_entry(enp, sftp, filter_idx);
|
||||
if (sftp->sft_used == 0)
|
||||
siena_filter_reset_search_depth(sfp, tbl_id);
|
||||
|
||||
EFSYS_UNLOCK(enp->en_eslp, state);
|
||||
return (0);
|
||||
|
@ -370,58 +370,54 @@ typedef struct efx_nic_ops_s {
|
||||
|
||||
#if EFSYS_OPT_FILTER
|
||||
|
||||
typedef struct falconsiena_filter_spec_s {
|
||||
uint8_t fsfs_type;
|
||||
uint32_t fsfs_flags;
|
||||
uint32_t fsfs_dmaq_id;
|
||||
uint32_t fsfs_dword[3];
|
||||
} falconsiena_filter_spec_t;
|
||||
typedef struct siena_filter_spec_s {
|
||||
uint8_t sfs_type;
|
||||
uint32_t sfs_flags;
|
||||
uint32_t sfs_dmaq_id;
|
||||
uint32_t sfs_dword[3];
|
||||
} siena_filter_spec_t;
|
||||
|
||||
typedef enum falconsiena_filter_type_e {
|
||||
EFX_FS_FILTER_RX_TCP_FULL, /* TCP/IPv4 4-tuple {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_FS_FILTER_RX_TCP_WILD, /* TCP/IPv4 dest {dIP,dTCP, -, -} */
|
||||
EFX_FS_FILTER_RX_UDP_FULL, /* UDP/IPv4 4-tuple {dIP,dUDP,sIP,sUDP} */
|
||||
EFX_FS_FILTER_RX_UDP_WILD, /* UDP/IPv4 dest {dIP,dUDP, -, -} */
|
||||
typedef enum siena_filter_type_e {
|
||||
EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */
|
||||
EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
|
||||
EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */
|
||||
EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
|
||||
EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
|
||||
|
||||
#if EFSYS_OPT_SIENA
|
||||
EFX_FS_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
|
||||
EFX_FS_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
|
||||
EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
|
||||
EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */
|
||||
EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */
|
||||
EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */
|
||||
|
||||
EFX_FS_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_FS_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
|
||||
EFX_FS_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
|
||||
EFX_FS_FILTER_TX_UDP_WILD, /* UDP/IPv4 source (host, port) */
|
||||
EFX_SIENA_FILTER_NTYPES
|
||||
} siena_filter_type_t;
|
||||
|
||||
EFX_FS_FILTER_TX_MAC_FULL, /* Ethernet source (MAC address, VLAN ID) */
|
||||
EFX_FS_FILTER_TX_MAC_WILD, /* Ethernet source (MAC address) */
|
||||
#endif /* EFSYS_OPT_SIENA */
|
||||
typedef enum siena_filter_tbl_id_e {
|
||||
EFX_SIENA_FILTER_TBL_RX_IP = 0,
|
||||
EFX_SIENA_FILTER_TBL_RX_MAC,
|
||||
EFX_SIENA_FILTER_TBL_TX_IP,
|
||||
EFX_SIENA_FILTER_TBL_TX_MAC,
|
||||
EFX_SIENA_FILTER_NTBLS
|
||||
} siena_filter_tbl_id_t;
|
||||
|
||||
EFX_FS_FILTER_NTYPES
|
||||
} falconsiena_filter_type_t;
|
||||
typedef struct siena_filter_tbl_s {
|
||||
int sft_size; /* number of entries */
|
||||
int sft_used; /* active count */
|
||||
uint32_t *sft_bitmap; /* active bitmap */
|
||||
siena_filter_spec_t *sft_spec; /* array of saved specs */
|
||||
} siena_filter_tbl_t;
|
||||
|
||||
typedef enum falconsiena_filter_tbl_id_e {
|
||||
EFX_FS_FILTER_TBL_RX_IP = 0,
|
||||
EFX_FS_FILTER_TBL_RX_MAC,
|
||||
EFX_FS_FILTER_TBL_TX_IP,
|
||||
EFX_FS_FILTER_TBL_TX_MAC,
|
||||
EFX_FS_FILTER_NTBLS
|
||||
} falconsiena_filter_tbl_id_t;
|
||||
|
||||
typedef struct falconsiena_filter_tbl_s {
|
||||
int fsft_size; /* number of entries */
|
||||
int fsft_used; /* active count */
|
||||
uint32_t *fsft_bitmap; /* active bitmap */
|
||||
falconsiena_filter_spec_t *fsft_spec; /* array of saved specs */
|
||||
} falconsiena_filter_tbl_t;
|
||||
|
||||
typedef struct falconsiena_filter_s {
|
||||
falconsiena_filter_tbl_t fsf_tbl[EFX_FS_FILTER_NTBLS];
|
||||
unsigned int fsf_depth[EFX_FS_FILTER_NTYPES];
|
||||
} falconsiena_filter_t;
|
||||
typedef struct siena_filter_s {
|
||||
siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS];
|
||||
unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES];
|
||||
} siena_filter_t;
|
||||
|
||||
typedef struct efx_filter_s {
|
||||
#if EFSYS_OPT_SIENA
|
||||
falconsiena_filter_t *ef_falconsiena_filter;
|
||||
siena_filter_t *ef_siena_filter;
|
||||
#endif /* EFSYS_OPT_SIENA */
|
||||
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
|
||||
ef10_filter_table_t *ef_ef10_filter_table;
|
||||
@ -431,7 +427,7 @@ typedef struct efx_filter_s {
|
||||
extern void
|
||||
siena_filter_tbl_clear(
|
||||
__in efx_nic_t *enp,
|
||||
__in falconsiena_filter_tbl_id_t tbl);
|
||||
__in siena_filter_tbl_id_t tbl);
|
||||
|
||||
#endif /* EFSYS_OPT_FILTER */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user