]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
sfc: support ndo_get_phys_port_id even when !CONFIG_SFC_SRIOV
authorBert Kenward <bkenward@solarflare.com>
Tue, 10 Jan 2017 16:23:33 +0000 (16:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Jan 2017 19:16:17 +0000 (14:16 -0500)
There's no good reason why this should be an SRIOV-only thing.
Thus, also move it out of SRIOV-specific files.

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/ef10_sriov.h
drivers/net/ethernet/sfc/efx.c
drivers/net/ethernet/sfc/net_driver.h
drivers/net/ethernet/sfc/sriov.c
drivers/net/ethernet/sfc/sriov.h

index 5eb0e684fd76a3de1f46210f9a9b6118d98041e3..4f3c965f5997bcf485d5fac6cb2d898cb2e9d34f 100644 (file)
@@ -5540,6 +5540,20 @@ static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx,
        }
 }
 
+static int efx_ef10_get_phys_port_id(struct efx_nic *efx,
+                                    struct netdev_phys_item_id *ppid)
+{
+       struct efx_ef10_nic_data *nic_data = efx->nic_data;
+
+       if (!is_valid_ether_addr(nic_data->port_id))
+               return -EOPNOTSUPP;
+
+       ppid->id_len = ETH_ALEN;
+       memcpy(ppid->id, nic_data->port_id, ppid->id_len);
+
+       return 0;
+}
+
 static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid)
 {
        if (proto != htons(ETH_P_8021Q))
@@ -5647,11 +5661,11 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
        .vswitching_probe = efx_ef10_vswitching_probe_vf,
        .vswitching_restore = efx_ef10_vswitching_restore_vf,
        .vswitching_remove = efx_ef10_vswitching_remove_vf,
-       .sriov_get_phys_port_id = efx_ef10_sriov_get_phys_port_id,
 #endif
        .get_mac_address = efx_ef10_get_mac_address_vf,
        .set_mac_address = efx_ef10_set_mac_address,
 
+       .get_phys_port_id = efx_ef10_get_phys_port_id,
        .revision = EFX_REV_HUNT_A0,
        .max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH),
        .rx_prefix_size = ES_DZ_RX_PREFIX_SIZE,
@@ -5776,6 +5790,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
        .set_mac_address = efx_ef10_set_mac_address,
        .tso_versions = efx_ef10_tso_versions,
 
+       .get_phys_port_id = efx_ef10_get_phys_port_id,
        .revision = EFX_REV_HUNT_A0,
        .max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH),
        .rx_prefix_size = ES_DZ_RX_PREFIX_SIZE,
index a949b9d27329e356146a18781cf92a14812c1631..a55c53d6f5594e748ade380a551884a4048c3891 100644 (file)
@@ -760,17 +760,3 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
 
        return 0;
 }
-
-int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx,
-                                   struct netdev_phys_item_id *ppid)
-{
-       struct efx_ef10_nic_data *nic_data = efx->nic_data;
-
-       if (!is_valid_ether_addr(nic_data->port_id))
-               return -EOPNOTSUPP;
-
-       ppid->id_len = ETH_ALEN;
-       memcpy(ppid->id, nic_data->port_id, ppid->id_len);
-
-       return 0;
-}
index 9ceb7ef0a210622e8d3e7c552ccae0cf0e01c245..2aa444ed42de5c7c77a77d79459c86a186e64d74 100644 (file)
@@ -56,9 +56,6 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
 int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
                                     int link_state);
 
-int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx,
-                                   struct netdev_phys_item_id *ppid);
-
 int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
 int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
 int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
index ebeecb8fed451247caf01f43c0df4f74f3208b80..eaae42fa109cc5e461d62f63ab883ed4219b4c42 100644 (file)
@@ -2334,6 +2334,17 @@ static int efx_set_features(struct net_device *net_dev, netdev_features_t data)
        return 0;
 }
 
+int efx_get_phys_port_id(struct net_device *net_dev,
+                        struct netdev_phys_item_id *ppid)
+{
+       struct efx_nic *efx = netdev_priv(net_dev);
+
+       if (efx->type->get_phys_port_id)
+               return efx->type->get_phys_port_id(efx, ppid);
+       else
+               return -EOPNOTSUPP;
+}
+
 static int efx_vlan_rx_add_vid(struct net_device *net_dev, __be16 proto, u16 vid)
 {
        struct efx_nic *efx = netdev_priv(net_dev);
@@ -2374,8 +2385,8 @@ static const struct net_device_ops efx_netdev_ops = {
        .ndo_set_vf_spoofchk    = efx_sriov_set_vf_spoofchk,
        .ndo_get_vf_config      = efx_sriov_get_vf_config,
        .ndo_set_vf_link_state  = efx_sriov_set_vf_link_state,
-       .ndo_get_phys_port_id   = efx_sriov_get_phys_port_id,
 #endif
+       .ndo_get_phys_port_id   = efx_get_phys_port_id,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller = efx_netpoll,
 #endif
index 1c62c1a00fca49679cb8a69a1ac1a5564be9868d..49db9e833c961862c8833dc1590a1f9574040b76 100644 (file)
@@ -1220,6 +1220,7 @@ struct efx_mtd_partition {
  * @ptp_set_ts_config: Set hardware timestamp configuration.  The flags
  *     and tx_type will already have been validated but this operation
  *     must validate and update rx_filter.
+ * @get_phys_port_id: Get the underlying physical port id.
  * @set_mac_address: Set the MAC address of the device
  * @tso_versions: Returns mask of firmware-assisted TSO versions supported.
  *     If %NULL, then device does not support any TSO version.
@@ -1358,6 +1359,8 @@ struct efx_nic_type {
        int (*sriov_configure)(struct efx_nic *efx, int num_vfs);
        int (*vlan_rx_add_vid)(struct efx_nic *efx, __be16 proto, u16 vid);
        int (*vlan_rx_kill_vid)(struct efx_nic *efx, __be16 proto, u16 vid);
+       int (*get_phys_port_id)(struct efx_nic *efx,
+                               struct netdev_phys_item_id *ppid);
        int (*sriov_init)(struct efx_nic *efx);
        void (*sriov_fini)(struct efx_nic *efx);
        bool (*sriov_wanted)(struct efx_nic *efx);
@@ -1372,8 +1375,6 @@ struct efx_nic_type {
                                   struct ifla_vf_info *ivi);
        int (*sriov_set_vf_link_state)(struct efx_nic *efx, int vf_i,
                                       int link_state);
-       int (*sriov_get_phys_port_id)(struct efx_nic *efx,
-                                     struct netdev_phys_item_id *ppid);
        int (*vswitching_probe)(struct efx_nic *efx);
        int (*vswitching_restore)(struct efx_nic *efx);
        void (*vswitching_remove)(struct efx_nic *efx);
index 9abcf4aded30735924b3a63bd04f070e1be1d3a4..0b766fdbcddbbdb18d77d40d51ee3660d6454a77 100644 (file)
@@ -73,14 +73,3 @@ int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
        else
                return -EOPNOTSUPP;
 }
-
-int efx_sriov_get_phys_port_id(struct net_device *net_dev,
-                              struct netdev_phys_item_id *ppid)
-{
-       struct efx_nic *efx = netdev_priv(net_dev);
-
-       if (efx->type->sriov_get_phys_port_id)
-               return efx->type->sriov_get_phys_port_id(efx, ppid);
-       else
-               return -EOPNOTSUPP;
-}
index ba1762e7f2165d49dcedfbba34430ccbf465da60..84c7984edcafa768fb856de3e07a42c7fd2623f6 100644 (file)
@@ -23,9 +23,6 @@ int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
                            struct ifla_vf_info *ivi);
 int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
                                int link_state);
-int efx_sriov_get_phys_port_id(struct net_device *net_dev,
-                              struct netdev_phys_item_id *ppid);
-
 #endif /* CONFIG_SFC_SRIOV */
 
 #endif /* EFX_SRIOV_H */