forked from Minki/linux
sfc: move vport_id to struct efx_nic
Remove some usage of ef10-specific nic_data structs from common MCDI functions, in preparation for using them from a non-EF10 driver. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a90f704ad9
commit
dfcabb0788
@ -553,7 +553,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
|
||||
|
||||
efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
|
||||
|
||||
nic_data->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
efx->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
|
||||
/* In case we're recovering from a crash (kexec), we want to
|
||||
* cancel any outstanding request by the previous user of this
|
||||
@ -1335,7 +1335,7 @@ static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx)
|
||||
|
||||
/* Driver-created vswitches and vports must be re-created */
|
||||
nic_data->must_probe_vswitching = true;
|
||||
nic_data->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
efx->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
#ifdef CONFIG_SFC_SRIOV
|
||||
if (nic_data->vf)
|
||||
for (i = 0; i < efx->vf_count; i++)
|
||||
@ -3158,22 +3158,22 @@ static int efx_ef10_vport_set_mac_address(struct efx_nic *efx)
|
||||
efx_mcdi_filter_table_remove(efx);
|
||||
up_write(&efx->filter_sem);
|
||||
|
||||
rc = efx_ef10_vadaptor_free(efx, nic_data->vport_id);
|
||||
rc = efx_ef10_vadaptor_free(efx, efx->vport_id);
|
||||
if (rc)
|
||||
goto restore_filters;
|
||||
|
||||
ether_addr_copy(mac_old, nic_data->vport_mac);
|
||||
rc = efx_ef10_vport_del_mac(efx, nic_data->vport_id,
|
||||
rc = efx_ef10_vport_del_mac(efx, efx->vport_id,
|
||||
nic_data->vport_mac);
|
||||
if (rc)
|
||||
goto restore_vadaptor;
|
||||
|
||||
rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id,
|
||||
rc = efx_ef10_vport_add_mac(efx, efx->vport_id,
|
||||
efx->net_dev->dev_addr);
|
||||
if (!rc) {
|
||||
ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr);
|
||||
} else {
|
||||
rc2 = efx_ef10_vport_add_mac(efx, nic_data->vport_id, mac_old);
|
||||
rc2 = efx_ef10_vport_add_mac(efx, efx->vport_id, mac_old);
|
||||
if (rc2) {
|
||||
/* Failed to add original MAC, so clear vport_mac */
|
||||
eth_zero_addr(nic_data->vport_mac);
|
||||
@ -3182,7 +3182,7 @@ static int efx_ef10_vport_set_mac_address(struct efx_nic *efx)
|
||||
}
|
||||
|
||||
restore_vadaptor:
|
||||
rc2 = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id);
|
||||
rc2 = efx_ef10_vadaptor_alloc(efx, efx->vport_id);
|
||||
if (rc2)
|
||||
goto reset_nic;
|
||||
restore_filters:
|
||||
@ -3225,7 +3225,7 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx)
|
||||
ether_addr_copy(MCDI_PTR(inbuf, VADAPTOR_SET_MAC_IN_MACADDR),
|
||||
efx->net_dev->dev_addr);
|
||||
MCDI_SET_DWORD(inbuf, VADAPTOR_SET_MAC_IN_UPSTREAM_PORT_ID,
|
||||
nic_data->vport_id);
|
||||
efx->vport_id);
|
||||
rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf,
|
||||
sizeof(inbuf), NULL, 0, NULL);
|
||||
|
||||
|
@ -232,15 +232,14 @@ fail:
|
||||
|
||||
static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx)
|
||||
{
|
||||
struct efx_ef10_nic_data *nic_data = efx->nic_data;
|
||||
u32 port_flags;
|
||||
int rc;
|
||||
|
||||
rc = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id);
|
||||
rc = efx_ef10_vadaptor_alloc(efx, efx->vport_id);
|
||||
if (rc)
|
||||
goto fail_vadaptor_alloc;
|
||||
|
||||
rc = efx_ef10_vadaptor_query(efx, nic_data->vport_id,
|
||||
rc = efx_ef10_vadaptor_query(efx, efx->vport_id,
|
||||
&port_flags, NULL, NULL);
|
||||
if (rc)
|
||||
goto fail_vadaptor_query;
|
||||
@ -281,11 +280,11 @@ int efx_ef10_vswitching_probe_pf(struct efx_nic *efx)
|
||||
|
||||
rc = efx_ef10_vport_alloc(efx, EVB_PORT_ID_ASSIGNED,
|
||||
MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL,
|
||||
EFX_EF10_NO_VLAN, &nic_data->vport_id);
|
||||
EFX_EF10_NO_VLAN, &efx->vport_id);
|
||||
if (rc)
|
||||
goto fail2;
|
||||
|
||||
rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id, net_dev->dev_addr);
|
||||
rc = efx_ef10_vport_add_mac(efx, efx->vport_id, net_dev->dev_addr);
|
||||
if (rc)
|
||||
goto fail3;
|
||||
ether_addr_copy(nic_data->vport_mac, net_dev->dev_addr);
|
||||
@ -296,11 +295,11 @@ int efx_ef10_vswitching_probe_pf(struct efx_nic *efx)
|
||||
|
||||
return 0;
|
||||
fail4:
|
||||
efx_ef10_vport_del_mac(efx, nic_data->vport_id, nic_data->vport_mac);
|
||||
efx_ef10_vport_del_mac(efx, efx->vport_id, nic_data->vport_mac);
|
||||
eth_zero_addr(nic_data->vport_mac);
|
||||
fail3:
|
||||
efx_ef10_vport_free(efx, nic_data->vport_id);
|
||||
nic_data->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
efx_ef10_vport_free(efx, efx->vport_id);
|
||||
efx->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
fail2:
|
||||
efx_ef10_vswitch_free(efx, EVB_PORT_ID_ASSIGNED);
|
||||
fail1:
|
||||
@ -355,22 +354,22 @@ void efx_ef10_vswitching_remove_pf(struct efx_nic *efx)
|
||||
|
||||
efx_ef10_sriov_free_vf_vswitching(efx);
|
||||
|
||||
efx_ef10_vadaptor_free(efx, nic_data->vport_id);
|
||||
efx_ef10_vadaptor_free(efx, efx->vport_id);
|
||||
|
||||
if (nic_data->vport_id == EVB_PORT_ID_ASSIGNED)
|
||||
if (efx->vport_id == EVB_PORT_ID_ASSIGNED)
|
||||
return; /* No vswitch was ever created */
|
||||
|
||||
if (!is_zero_ether_addr(nic_data->vport_mac)) {
|
||||
efx_ef10_vport_del_mac(efx, nic_data->vport_id,
|
||||
efx_ef10_vport_del_mac(efx, efx->vport_id,
|
||||
efx->net_dev->dev_addr);
|
||||
eth_zero_addr(nic_data->vport_mac);
|
||||
}
|
||||
efx_ef10_vport_free(efx, nic_data->vport_id);
|
||||
nic_data->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
efx_ef10_vport_free(efx, efx->vport_id);
|
||||
efx->vport_id = EVB_PORT_ID_ASSIGNED;
|
||||
|
||||
/* Only free the vswitch if no VFs are assigned */
|
||||
if (!pci_vfs_assigned(efx->pci_dev))
|
||||
efx_ef10_vswitch_free(efx, nic_data->vport_id);
|
||||
efx_ef10_vswitch_free(efx, efx->vport_id);
|
||||
}
|
||||
|
||||
void efx_ef10_vswitching_remove_vf(struct efx_nic *efx)
|
||||
|
@ -186,7 +186,6 @@ static void efx_mcdi_filter_push_prep(struct efx_nic *efx,
|
||||
struct efx_rss_context *ctx,
|
||||
bool replacing)
|
||||
{
|
||||
struct efx_ef10_nic_data *nic_data = efx->nic_data;
|
||||
u32 flags = spec->flags;
|
||||
|
||||
memset(inbuf, 0, MC_CMD_FILTER_OP_EXT_IN_LEN);
|
||||
@ -211,7 +210,7 @@ static void efx_mcdi_filter_push_prep(struct efx_nic *efx,
|
||||
efx_mcdi_filter_push_prep_set_match_fields(efx, spec, inbuf);
|
||||
}
|
||||
|
||||
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_PORT_ID, nic_data->vport_id);
|
||||
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_PORT_ID, efx->vport_id);
|
||||
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_DEST,
|
||||
spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
|
||||
MC_CMD_FILTER_OP_IN_RX_DEST_DROP :
|
||||
@ -1944,7 +1943,7 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
|
||||
nic_data->vport_id);
|
||||
efx->vport_id);
|
||||
MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type);
|
||||
MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_NUM_QUEUES, rss_spread);
|
||||
|
||||
|
@ -168,21 +168,18 @@ int efx_mcdi_tx_init(struct efx_tx_queue *tx_queue, bool tso_v2)
|
||||
size_t entries = tx_queue->txd.buf.len / EFX_BUF_SIZE;
|
||||
struct efx_channel *channel = tx_queue->channel;
|
||||
struct efx_nic *efx = tx_queue->efx;
|
||||
struct efx_ef10_nic_data *nic_data;
|
||||
dma_addr_t dma_addr;
|
||||
size_t inlen;
|
||||
int rc, i;
|
||||
|
||||
BUILD_BUG_ON(MC_CMD_INIT_TXQ_OUT_LEN != 0);
|
||||
|
||||
nic_data = efx->nic_data;
|
||||
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_SIZE, tx_queue->ptr_mask + 1);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_TARGET_EVQ, channel->channel);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_LABEL, tx_queue->queue);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_INSTANCE, tx_queue->queue);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_OWNER_ID, 0);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_PORT_ID, nic_data->vport_id);
|
||||
MCDI_SET_DWORD(inbuf, INIT_TXQ_IN_PORT_ID, efx->vport_id);
|
||||
|
||||
dma_addr = tx_queue->txd.buf.dma_addr;
|
||||
|
||||
@ -276,7 +273,6 @@ void efx_mcdi_rx_init(struct efx_rx_queue *rx_queue)
|
||||
struct efx_channel *channel = efx_rx_queue_channel(rx_queue);
|
||||
size_t entries = rx_queue->rxd.buf.len / EFX_BUF_SIZE;
|
||||
struct efx_nic *efx = rx_queue->efx;
|
||||
struct efx_ef10_nic_data *nic_data = efx->nic_data;
|
||||
dma_addr_t dma_addr;
|
||||
size_t inlen;
|
||||
int rc;
|
||||
@ -295,7 +291,7 @@ void efx_mcdi_rx_init(struct efx_rx_queue *rx_queue)
|
||||
INIT_RXQ_IN_FLAG_PREFIX, 1,
|
||||
INIT_RXQ_IN_FLAG_TIMESTAMP, 1);
|
||||
MCDI_SET_DWORD(inbuf, INIT_RXQ_IN_OWNER_ID, 0);
|
||||
MCDI_SET_DWORD(inbuf, INIT_RXQ_IN_PORT_ID, nic_data->vport_id);
|
||||
MCDI_SET_DWORD(inbuf, INIT_RXQ_IN_PORT_ID, efx->vport_id);
|
||||
|
||||
dma_addr = rx_queue->rxd.buf.dma_addr;
|
||||
|
||||
|
@ -722,11 +722,8 @@ static int efx_mcdi_mac_stats(struct efx_nic *efx,
|
||||
MAC_STATS_IN_PERIOD_MS, period);
|
||||
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len);
|
||||
|
||||
if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0) {
|
||||
struct efx_ef10_nic_data *nic_data = efx->nic_data;
|
||||
|
||||
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, nic_data->vport_id);
|
||||
}
|
||||
if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0)
|
||||
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, efx->vport_id);
|
||||
|
||||
rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf),
|
||||
NULL, 0, NULL);
|
||||
|
@ -887,6 +887,7 @@ struct efx_async_filter_insertion {
|
||||
* @rss_context: Main RSS context. Its @list member is the head of the list of
|
||||
* RSS contexts created by user requests
|
||||
* @rss_lock: Protects custom RSS context software state in @rss_context.list
|
||||
* @vport_id: The function's vport ID, only relevant for PFs
|
||||
* @int_error_count: Number of internal errors seen recently
|
||||
* @int_error_expire: Time at which error count will be expired
|
||||
* @irq_soft_enabled: Are IRQs soft-enabled? If not, IRQ handler will
|
||||
@ -1044,6 +1045,7 @@ struct efx_nic {
|
||||
bool rx_scatter;
|
||||
struct efx_rss_context rss_context;
|
||||
struct mutex rss_lock;
|
||||
u32 vport_id;
|
||||
|
||||
unsigned int_error_count;
|
||||
unsigned long int_error_expire;
|
||||
|
@ -385,7 +385,6 @@ enum {
|
||||
* %MC_CMD_GET_CAPABILITIES response)
|
||||
* @rx_dpcpu_fw_id: Firmware ID of the RxDPCPU
|
||||
* @tx_dpcpu_fw_id: Firmware ID of the TxDPCPU
|
||||
* @vport_id: The function's vport ID, only relevant for PFs
|
||||
* @must_probe_vswitching: Flag: vswitching has yet to be setup after MC reboot
|
||||
* @pf_index: The number for this PF, or the parent PF if this is a VF
|
||||
#ifdef CONFIG_SFC_SRIOV
|
||||
@ -423,7 +422,6 @@ struct efx_ef10_nic_data {
|
||||
u32 datapath_caps2;
|
||||
unsigned int rx_dpcpu_fw_id;
|
||||
unsigned int tx_dpcpu_fw_id;
|
||||
unsigned int vport_id;
|
||||
bool must_probe_vswitching;
|
||||
unsigned int pf_index;
|
||||
u8 port_id[ETH_ALEN];
|
||||
|
Loading…
Reference in New Issue
Block a user