|
@@ -134,6 +134,22 @@ static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx,
|
|
|
static void efx_ef10_filter_del_vlan(struct efx_nic *efx, u16 vid);
|
|
|
static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading);
|
|
|
|
|
|
+static u32 efx_ef10_filter_get_unsafe_id(u32 filter_id)
|
|
|
+{
|
|
|
+ WARN_ON_ONCE(filter_id == EFX_EF10_FILTER_ID_INVALID);
|
|
|
+ return filter_id & (HUNT_FILTER_TBL_ROWS - 1);
|
|
|
+}
|
|
|
+
|
|
|
+static unsigned int efx_ef10_filter_get_unsafe_pri(u32 filter_id)
|
|
|
+{
|
|
|
+ return filter_id / (HUNT_FILTER_TBL_ROWS * 2);
|
|
|
+}
|
|
|
+
|
|
|
+static u32 efx_ef10_make_filter_id(unsigned int pri, u16 idx)
|
|
|
+{
|
|
|
+ return pri * HUNT_FILTER_TBL_ROWS * 2 + idx;
|
|
|
+}
|
|
|
+
|
|
|
static int efx_ef10_get_warm_boot_count(struct efx_nic *efx)
|
|
|
{
|
|
|
efx_dword_t reg;
|
|
@@ -4194,7 +4210,7 @@ found:
|
|
|
|
|
|
/* If successful, return the inserted filter ID */
|
|
|
if (rc == 0)
|
|
|
- rc = match_pri * HUNT_FILTER_TBL_ROWS + ins_index;
|
|
|
+ rc = efx_ef10_make_filter_id(match_pri, ins_index);
|
|
|
|
|
|
wake_up_all(&table->waitq);
|
|
|
out_unlock:
|
|
@@ -4217,7 +4233,7 @@ static int efx_ef10_filter_remove_internal(struct efx_nic *efx,
|
|
|
unsigned int priority_mask,
|
|
|
u32 filter_id, bool by_index)
|
|
|
{
|
|
|
- unsigned int filter_idx = filter_id % HUNT_FILTER_TBL_ROWS;
|
|
|
+ unsigned int filter_idx = efx_ef10_filter_get_unsafe_id(filter_id);
|
|
|
struct efx_ef10_filter_table *table = efx->filter_state;
|
|
|
MCDI_DECLARE_BUF(inbuf,
|
|
|
MC_CMD_FILTER_OP_IN_HANDLE_OFST +
|
|
@@ -4244,7 +4260,7 @@ static int efx_ef10_filter_remove_internal(struct efx_nic *efx,
|
|
|
if (!spec ||
|
|
|
(!by_index &&
|
|
|
efx_ef10_filter_pri(table, spec) !=
|
|
|
- filter_id / HUNT_FILTER_TBL_ROWS)) {
|
|
|
+ efx_ef10_filter_get_unsafe_pri(filter_id))) {
|
|
|
rc = -ENOENT;
|
|
|
goto out_unlock;
|
|
|
}
|
|
@@ -4293,13 +4309,18 @@ static int efx_ef10_filter_remove_internal(struct efx_nic *efx,
|
|
|
MC_CMD_FILTER_OP_IN_OP_UNSUBSCRIBE);
|
|
|
MCDI_SET_QWORD(inbuf, FILTER_OP_IN_HANDLE,
|
|
|
table->entry[filter_idx].handle);
|
|
|
- rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP,
|
|
|
- inbuf, sizeof(inbuf), NULL, 0, NULL);
|
|
|
+ rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FILTER_OP,
|
|
|
+ inbuf, sizeof(inbuf), NULL, 0, NULL);
|
|
|
|
|
|
spin_lock_bh(&efx->filter_lock);
|
|
|
- if (rc == 0) {
|
|
|
+ if ((rc == 0) || (rc == -ENOENT)) {
|
|
|
+ /* Filter removed OK or didn't actually exist */
|
|
|
kfree(spec);
|
|
|
efx_ef10_filter_set_entry(table, filter_idx, NULL, 0);
|
|
|
+ } else {
|
|
|
+ efx_mcdi_display_error(efx, MC_CMD_FILTER_OP,
|
|
|
+ MC_CMD_FILTER_OP_IN_LEN,
|
|
|
+ NULL, 0, rc);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4319,11 +4340,6 @@ static int efx_ef10_filter_remove_safe(struct efx_nic *efx,
|
|
|
filter_id, false);
|
|
|
}
|
|
|
|
|
|
-static u32 efx_ef10_filter_get_unsafe_id(struct efx_nic *efx, u32 filter_id)
|
|
|
-{
|
|
|
- return filter_id % HUNT_FILTER_TBL_ROWS;
|
|
|
-}
|
|
|
-
|
|
|
static void efx_ef10_filter_remove_unsafe(struct efx_nic *efx,
|
|
|
enum efx_filter_priority priority,
|
|
|
u32 filter_id)
|
|
@@ -4337,7 +4353,7 @@ static int efx_ef10_filter_get_safe(struct efx_nic *efx,
|
|
|
enum efx_filter_priority priority,
|
|
|
u32 filter_id, struct efx_filter_spec *spec)
|
|
|
{
|
|
|
- unsigned int filter_idx = filter_id % HUNT_FILTER_TBL_ROWS;
|
|
|
+ unsigned int filter_idx = efx_ef10_filter_get_unsafe_id(filter_id);
|
|
|
struct efx_ef10_filter_table *table = efx->filter_state;
|
|
|
const struct efx_filter_spec *saved_spec;
|
|
|
int rc;
|
|
@@ -4346,7 +4362,7 @@ static int efx_ef10_filter_get_safe(struct efx_nic *efx,
|
|
|
saved_spec = efx_ef10_filter_entry_spec(table, filter_idx);
|
|
|
if (saved_spec && saved_spec->priority == priority &&
|
|
|
efx_ef10_filter_pri(table, saved_spec) ==
|
|
|
- filter_id / HUNT_FILTER_TBL_ROWS) {
|
|
|
+ efx_ef10_filter_get_unsafe_pri(filter_id)) {
|
|
|
*spec = *saved_spec;
|
|
|
rc = 0;
|
|
|
} else {
|
|
@@ -4398,7 +4414,7 @@ static u32 efx_ef10_filter_get_rx_id_limit(struct efx_nic *efx)
|
|
|
{
|
|
|
struct efx_ef10_filter_table *table = efx->filter_state;
|
|
|
|
|
|
- return table->rx_match_count * HUNT_FILTER_TBL_ROWS;
|
|
|
+ return table->rx_match_count * HUNT_FILTER_TBL_ROWS * 2;
|
|
|
}
|
|
|
|
|
|
static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
|
|
@@ -4418,8 +4434,9 @@ static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
|
|
|
count = -EMSGSIZE;
|
|
|
break;
|
|
|
}
|
|
|
- buf[count++] = (efx_ef10_filter_pri(table, spec) *
|
|
|
- HUNT_FILTER_TBL_ROWS +
|
|
|
+ buf[count++] =
|
|
|
+ efx_ef10_make_filter_id(
|
|
|
+ efx_ef10_filter_pri(table, spec),
|
|
|
filter_idx);
|
|
|
}
|
|
|
}
|
|
@@ -4971,7 +4988,7 @@ static void efx_ef10_filter_mark_one_old(struct efx_nic *efx, uint16_t *id)
|
|
|
unsigned int filter_idx;
|
|
|
|
|
|
if (*id != EFX_EF10_FILTER_ID_INVALID) {
|
|
|
- filter_idx = efx_ef10_filter_get_unsafe_id(efx, *id);
|
|
|
+ filter_idx = efx_ef10_filter_get_unsafe_id(*id);
|
|
|
if (!table->entry[filter_idx].spec)
|
|
|
netif_dbg(efx, drv, efx->net_dev,
|
|
|
"marked null spec old %04x:%04x\n", *id,
|
|
@@ -5106,7 +5123,7 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
|
|
|
rc = EFX_EF10_FILTER_ID_INVALID;
|
|
|
}
|
|
|
}
|
|
|
- ids[i] = efx_ef10_filter_get_unsafe_id(efx, rc);
|
|
|
+ ids[i] = efx_ef10_filter_get_unsafe_id(rc);
|
|
|
}
|
|
|
|
|
|
if (multicast && rollback) {
|
|
@@ -5130,7 +5147,7 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
|
|
|
return rc;
|
|
|
} else {
|
|
|
vlan->default_filters[EFX_EF10_BCAST] =
|
|
|
- efx_ef10_filter_get_unsafe_id(efx, rc);
|
|
|
+ efx_ef10_filter_get_unsafe_id(rc);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5225,7 +5242,7 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx,
|
|
|
id = &vlan->default_filters[map[encap_type]];
|
|
|
|
|
|
EFX_WARN_ON_PARANOID(*id != EFX_EF10_FILTER_ID_INVALID);
|
|
|
- *id = efx_ef10_filter_get_unsafe_id(efx, rc);
|
|
|
+ *id = efx_ef10_filter_get_unsafe_id(rc);
|
|
|
if (!nic_data->workaround_26807 && !encap_type) {
|
|
|
/* Also need an Ethernet broadcast filter */
|
|
|
efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO,
|
|
@@ -5250,7 +5267,7 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx,
|
|
|
vlan->default_filters[EFX_EF10_BCAST] !=
|
|
|
EFX_EF10_FILTER_ID_INVALID);
|
|
|
vlan->default_filters[EFX_EF10_BCAST] =
|
|
|
- efx_ef10_filter_get_unsafe_id(efx, rc);
|
|
|
+ efx_ef10_filter_get_unsafe_id(rc);
|
|
|
}
|
|
|
}
|
|
|
rc = 0;
|
|
@@ -5372,7 +5389,7 @@ restore_filters:
|
|
|
if (rc2)
|
|
|
goto reset_nic;
|
|
|
|
|
|
- netif_device_attach(efx->net_dev);
|
|
|
+ efx_device_attach_if_not_resetting(efx);
|
|
|
|
|
|
return rc;
|
|
|
|
|
@@ -5658,7 +5675,7 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx)
|
|
|
|
|
|
if (was_enabled)
|
|
|
efx_net_open(efx->net_dev);
|
|
|
- netif_device_attach(efx->net_dev);
|
|
|
+ efx_device_attach_if_not_resetting(efx);
|
|
|
|
|
|
#ifdef CONFIG_SFC_SRIOV
|
|
|
if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) {
|
|
@@ -6110,7 +6127,7 @@ static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading)
|
|
|
|
|
|
if (!(nic_data->datapath_caps &
|
|
|
(1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN))) {
|
|
|
- netif_device_attach(efx->net_dev);
|
|
|
+ efx_device_attach_if_not_resetting(efx);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -6182,7 +6199,7 @@ static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading)
|
|
|
* trigger a re-attach. Since there won't be an MC reset, we
|
|
|
* have to do the attach ourselves.
|
|
|
*/
|
|
|
- netif_device_attach(efx->net_dev);
|
|
|
+ efx_device_attach_if_not_resetting(efx);
|
|
|
}
|
|
|
|
|
|
return rc;
|