aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-04-05 10:00:02 -0400
committerBen Hutchings <bhutchings@solarflare.com>2011-04-05 10:00:02 -0400
commitabfe903980161b11f3594e3dcbab8b5c5a67168b (patch)
tree4bfde1e260cdfe855cfa0e94718ecb1747bac3b4 /drivers/net/sfc/efx.c
parentf82d9a67fbcdfd8af6be7a7c9e381864ec9a271a (diff)
sfc: Implement generic features interface
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r--drivers/net/sfc/efx.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 542f32d21acf..db72a6e054e1 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1874,6 +1874,17 @@ static void efx_set_multicast_list(struct net_device *net_dev)
1874 /* Otherwise efx_start_port() will do this */ 1874 /* Otherwise efx_start_port() will do this */
1875} 1875}
1876 1876
1877static int efx_set_features(struct net_device *net_dev, u32 data)
1878{
1879 struct efx_nic *efx = netdev_priv(net_dev);
1880
1881 /* If disabling RX n-tuple filtering, clear existing filters */
1882 if (net_dev->features & ~data & NETIF_F_NTUPLE)
1883 efx_filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL);
1884
1885 return 0;
1886}
1887
1877static const struct net_device_ops efx_netdev_ops = { 1888static const struct net_device_ops efx_netdev_ops = {
1878 .ndo_open = efx_net_open, 1889 .ndo_open = efx_net_open,
1879 .ndo_stop = efx_net_stop, 1890 .ndo_stop = efx_net_stop,
@@ -1885,6 +1896,7 @@ static const struct net_device_ops efx_netdev_ops = {
1885 .ndo_change_mtu = efx_change_mtu, 1896 .ndo_change_mtu = efx_change_mtu,
1886 .ndo_set_mac_address = efx_set_mac_address, 1897 .ndo_set_mac_address = efx_set_mac_address,
1887 .ndo_set_multicast_list = efx_set_multicast_list, 1898 .ndo_set_multicast_list = efx_set_multicast_list,
1899 .ndo_set_features = efx_set_features,
1888#ifdef CONFIG_NET_POLL_CONTROLLER 1900#ifdef CONFIG_NET_POLL_CONTROLLER
1889 .ndo_poll_controller = efx_netpoll, 1901 .ndo_poll_controller = efx_netpoll,
1890#endif 1902#endif
@@ -2269,7 +2281,6 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
2269 strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name)); 2281 strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
2270 2282
2271 efx->net_dev = net_dev; 2283 efx->net_dev = net_dev;
2272 efx->rx_checksum_enabled = true;
2273 spin_lock_init(&efx->stats_lock); 2284 spin_lock_init(&efx->stats_lock);
2274 mutex_init(&efx->mac_lock); 2285 mutex_init(&efx->mac_lock);
2275 efx->mac_op = type->default_mac_ops; 2286 efx->mac_op = type->default_mac_ops;
@@ -2452,12 +2463,15 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2452 return -ENOMEM; 2463 return -ENOMEM;
2453 net_dev->features |= (type->offload_features | NETIF_F_SG | 2464 net_dev->features |= (type->offload_features | NETIF_F_SG |
2454 NETIF_F_HIGHDMA | NETIF_F_TSO | 2465 NETIF_F_HIGHDMA | NETIF_F_TSO |
2455 NETIF_F_GRO); 2466 NETIF_F_RXCSUM);
2456 if (type->offload_features & NETIF_F_V6_CSUM) 2467 if (type->offload_features & NETIF_F_V6_CSUM)
2457 net_dev->features |= NETIF_F_TSO6; 2468 net_dev->features |= NETIF_F_TSO6;
2458 /* Mask for features that also apply to VLAN devices */ 2469 /* Mask for features that also apply to VLAN devices */
2459 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG | 2470 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |
2460 NETIF_F_HIGHDMA | NETIF_F_ALL_TSO); 2471 NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
2472 NETIF_F_RXCSUM);
2473 /* All offloads can be toggled */
2474 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA;
2461 efx = netdev_priv(net_dev); 2475 efx = netdev_priv(net_dev);
2462 pci_set_drvdata(pci_dev, efx); 2476 pci_set_drvdata(pci_dev, efx);
2463 SET_NETDEV_DEV(net_dev, &pci_dev->dev); 2477 SET_NETDEV_DEV(net_dev, &pci_dev->dev);