]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sfc: move vport_id to struct efx_nic
authorEdward Cree <ecree@solarflare.com>
Mon, 11 May 2020 12:28:20 +0000 (13:28 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 May 2020 20:31:49 +0000 (13:31 -0700)
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>
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/ef10_sriov.c
drivers/net/ethernet/sfc/mcdi_filters.c
drivers/net/ethernet/sfc/mcdi_functions.c
drivers/net/ethernet/sfc/mcdi_port.c
drivers/net/ethernet/sfc/net_driver.h
drivers/net/ethernet/sfc/nic.h

index 3f16bd807c6ef65b71917a9a5af5b7235db18b9b..0ad311ff6796b5e7d5a897bbc0f508e1b6ef4fe8 100644 (file)
@@ -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);
 
index 4580b30caae1bebb6761a773955b5adc51b90881..21fa6c0e88734ea5a7cf81dc2b1a12febc122be4 100644 (file)
@@ -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)
index 4310ae5bd898b288aa3c2812c3ec240cc0f0e2f1..e6268556b030720fd68517ea5bbf58d6e0f9e6d2 100644 (file)
@@ -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);
 
index dcfe78b0fa5a409c2ed2570dad50d11b5f427ffb..962d8395d958de5a317beefc93f9fbf58772f51f 100644 (file)
@@ -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;
 
index ab5227b13ae60aa046a567f29062c50e0d309875..b807871d8f69f287e9c8d0dc41bb2198de132901 100644 (file)
@@ -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);
index b084e623b5f443ccba50835bd7a8f7bcdc039d76..d43f22c8f31c7e2f13292585f2aa9a5aa5566234 100644 (file)
@@ -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;
index 6670fda8f35a2ececfd15d38620ed06b36520853..9e2e387a4b1c6e2fb9d229abd557cdca8912844f 100644 (file)
@@ -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];