]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/sfc/efx.c
sfc: Use generic MDIO functions and definitions
[net-next-2.6.git] / drivers / net / sfc / efx.c
index dee23b159df2b26deff21e9d18c70339ace15daf..d3e240b736c73d97ed6241ea6e1b07bc1068e18c 100644 (file)
@@ -448,9 +448,6 @@ static void efx_init_channels(struct efx_nic *efx)
 
                WARN_ON(channel->rx_pkt != NULL);
                efx_rx_strategy(channel);
-
-               netif_napi_add(channel->napi_dev, &channel->napi_str,
-                              efx_poll, napi_weight);
        }
 }
 
@@ -1303,10 +1300,16 @@ out_requeue:
 static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
 {
        struct efx_nic *efx = netdev_priv(net_dev);
+       struct mii_ioctl_data *data = if_mii(ifr);
 
        EFX_ASSERT_RESET_SERIALISED(efx);
 
-       return generic_mii_ioctl(&efx->mii, if_mii(ifr), cmd, NULL);
+       /* Convert phy_id from older PRTAD/DEVAD format */
+       if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
+           (data->phy_id & 0xfc00) == 0x0400)
+               data->phy_id ^= MDIO_PHY_ID_C45 | 0x0400;
+
+       return mdio_mii_ioctl(&efx->mdio, data, cmd);
 }
 
 /**************************************************************************
@@ -1321,6 +1324,8 @@ static int efx_init_napi(struct efx_nic *efx)
 
        efx_for_each_channel(channel, efx) {
                channel->napi_dev = efx->net_dev;
+               netif_napi_add(channel->napi_dev, &channel->napi_str,
+                              efx_poll, napi_weight);
        }
        return 0;
 }
@@ -1330,6 +1335,8 @@ static void efx_fini_napi(struct efx_nic *efx)
        struct efx_channel *channel;
 
        efx_for_each_channel(channel, efx) {
+               if (channel->napi_dev)
+                       netif_napi_del(&channel->napi_str);
                channel->napi_dev = NULL;
        }
 }
@@ -1944,7 +1951,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
        mutex_init(&efx->mac_lock);
        efx->mac_op = &efx_dummy_mac_operations;
        efx->phy_op = &efx_dummy_phy_operations;
-       efx->mii.dev = net_dev;
+       efx->mdio.dev = net_dev;
        INIT_WORK(&efx->phy_work, efx_phy_work);
        INIT_WORK(&efx->mac_work, efx_mac_work);
        atomic_set(&efx->netif_stop_count, 1);