]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
sfc: move mac configuration and status functions
authorAlex Maftei (amaftei) <amaftei@solarflare.com>
Wed, 8 Jan 2020 16:11:13 +0000 (16:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jan 2020 21:28:02 +0000 (13:28 -0800)
Two small functions with different purposes.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/efx.c
drivers/net/ethernet/sfc/efx_common.c

index c881e35b047721396e42eb68fa8f8193d016e9df..752470baf4bebd4dc4d7b86128679892229753f8 100644 (file)
@@ -935,40 +935,6 @@ void efx_channel_dummy_op_void(struct efx_channel *channel)
  *
  **************************************************************************/
 
-/* This ensures that the kernel is kept informed (via
- * netif_carrier_on/off) of the link status, and also maintains the
- * link status's stop on the port's TX queue.
- */
-void efx_link_status_changed(struct efx_nic *efx)
-{
-       struct efx_link_state *link_state = &efx->link_state;
-
-       /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure
-        * that no events are triggered between unregister_netdev() and the
-        * driver unloading. A more general condition is that NETDEV_CHANGE
-        * can only be generated between NETDEV_UP and NETDEV_DOWN */
-       if (!netif_running(efx->net_dev))
-               return;
-
-       if (link_state->up != netif_carrier_ok(efx->net_dev)) {
-               efx->n_link_state_changes++;
-
-               if (link_state->up)
-                       netif_carrier_on(efx->net_dev);
-               else
-                       netif_carrier_off(efx->net_dev);
-       }
-
-       /* Status message for kernel log */
-       if (link_state->up)
-               netif_info(efx, link, efx->net_dev,
-                          "link up at %uMbps %s-duplex (MTU %d)\n",
-                          link_state->speed, link_state->fd ? "full" : "half",
-                          efx->net_dev->mtu);
-       else
-               netif_info(efx, link, efx->net_dev, "link down\n");
-}
-
 void efx_link_set_advertising(struct efx_nic *efx,
                              const unsigned long *advertising)
 {
@@ -1010,16 +976,6 @@ void efx_link_set_wanted_fc(struct efx_nic *efx, u8 wanted_fc)
 
 static void efx_fini_port(struct efx_nic *efx);
 
-/* We assume that efx->type->reconfigure_mac will always try to sync RX
- * filters and therefore needs to read-lock the filter table against freeing
- */
-void efx_mac_reconfigure(struct efx_nic *efx)
-{
-       down_read(&efx->filter_sem);
-       efx->type->reconfigure_mac(efx);
-       up_read(&efx->filter_sem);
-}
-
 /* Push loopback/power/transmit disable settings to the PHY, and reconfigure
  * the MAC appropriately. All other PHY configuration changes are pushed
  * through phy_op->set_settings(), and pushed asynchronously to the MAC
index 5cadfba37fc4e36c5ebc20f0372026226c3418ac..be8e80c9d513d0214291e69e8d180d6a20e6dfeb 100644 (file)
@@ -56,3 +56,48 @@ void efx_destroy_reset_workqueue(void)
                reset_workqueue = NULL;
        }
 }
+
+/* We assume that efx->type->reconfigure_mac will always try to sync RX
+ * filters and therefore needs to read-lock the filter table against freeing
+ */
+void efx_mac_reconfigure(struct efx_nic *efx)
+{
+       down_read(&efx->filter_sem);
+       efx->type->reconfigure_mac(efx);
+       up_read(&efx->filter_sem);
+}
+
+/* This ensures that the kernel is kept informed (via
+ * netif_carrier_on/off) of the link status, and also maintains the
+ * link status's stop on the port's TX queue.
+ */
+void efx_link_status_changed(struct efx_nic *efx)
+{
+       struct efx_link_state *link_state = &efx->link_state;
+
+       /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure
+        * that no events are triggered between unregister_netdev() and the
+        * driver unloading. A more general condition is that NETDEV_CHANGE
+        * can only be generated between NETDEV_UP and NETDEV_DOWN
+        */
+       if (!netif_running(efx->net_dev))
+               return;
+
+       if (link_state->up != netif_carrier_ok(efx->net_dev)) {
+               efx->n_link_state_changes++;
+
+               if (link_state->up)
+                       netif_carrier_on(efx->net_dev);
+               else
+                       netif_carrier_off(efx->net_dev);
+       }
+
+       /* Status message for kernel log */
+       if (link_state->up)
+               netif_info(efx, link, efx->net_dev,
+                          "link up at %uMbps %s-duplex (MTU %d)\n",
+                          link_state->speed, link_state->fd ? "full" : "half",
+                          efx->net_dev->mtu);
+       else
+               netif_info(efx, link, efx->net_dev, "link down\n");
+}