aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-04 21:36:58 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-06 17:49:10 -0400
commit066413dac420c8225e3ef7f0f76c3255448782d3 (patch)
treefb171ecf667592790ccd52e24c97757b1b976d77 /drivers/net/netxen/netxen_nic_main.c
parent1f90d6657c1ce2eaa4c7fbd1fb36738542f2b650 (diff)
net: netxen: convert to hw_features
Rather simple conversion to hw_features. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c53
1 files changed, 43 insertions, 10 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 933671556c15..201b944bd463 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -485,6 +485,37 @@ static void netxen_set_multicast_list(struct net_device *dev)
485 adapter->set_multi(dev); 485 adapter->set_multi(dev);
486} 486}
487 487
488static u32 netxen_fix_features(struct net_device *dev, u32 features)
489{
490 if (!(features & NETIF_F_RXCSUM)) {
491 netdev_info(dev, "disabling LRO as RXCSUM is off\n");
492
493 features &= ~NETIF_F_LRO;
494 }
495
496 return features;
497}
498
499static int netxen_set_features(struct net_device *dev, u32 features)
500{
501 struct netxen_adapter *adapter = netdev_priv(dev);
502 int hw_lro;
503
504 if (!((dev->features ^ features) & NETIF_F_LRO))
505 return 0;
506
507 hw_lro = (features & NETIF_F_LRO) ? NETXEN_NIC_LRO_ENABLED
508 : NETXEN_NIC_LRO_DISABLED;
509
510 if (netxen_config_hw_lro(adapter, hw_lro))
511 return -EIO;
512
513 if (!(features & NETIF_F_LRO) && netxen_send_lro_cleanup(adapter))
514 return -EIO;
515
516 return 0;
517}
518
488static const struct net_device_ops netxen_netdev_ops = { 519static const struct net_device_ops netxen_netdev_ops = {
489 .ndo_open = netxen_nic_open, 520 .ndo_open = netxen_nic_open,
490 .ndo_stop = netxen_nic_close, 521 .ndo_stop = netxen_nic_close,
@@ -495,6 +526,8 @@ static const struct net_device_ops netxen_netdev_ops = {
495 .ndo_set_mac_address = netxen_nic_set_mac, 526 .ndo_set_mac_address = netxen_nic_set_mac,
496 .ndo_change_mtu = netxen_nic_change_mtu, 527 .ndo_change_mtu = netxen_nic_change_mtu,
497 .ndo_tx_timeout = netxen_tx_timeout, 528 .ndo_tx_timeout = netxen_tx_timeout,
529 .ndo_fix_features = netxen_fix_features,
530 .ndo_set_features = netxen_set_features,
498#ifdef CONFIG_NET_POLL_CONTROLLER 531#ifdef CONFIG_NET_POLL_CONTROLLER
499 .ndo_poll_controller = netxen_nic_poll_controller, 532 .ndo_poll_controller = netxen_nic_poll_controller,
500#endif 533#endif
@@ -1196,7 +1229,6 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
1196 int err = 0; 1229 int err = 0;
1197 struct pci_dev *pdev = adapter->pdev; 1230 struct pci_dev *pdev = adapter->pdev;
1198 1231
1199 adapter->rx_csum = 1;
1200 adapter->mc_enabled = 0; 1232 adapter->mc_enabled = 0;
1201 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) 1233 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
1202 adapter->max_mc_count = 38; 1234 adapter->max_mc_count = 38;
@@ -1210,14 +1242,13 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
1210 1242
1211 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); 1243 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
1212 1244
1213 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO); 1245 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
1214 netdev->features |= (NETIF_F_GRO); 1246 NETIF_F_RXCSUM;
1215 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
1216 1247
1217 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 1248 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
1218 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6); 1249 netdev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
1219 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6); 1250
1220 } 1251 netdev->vlan_features |= netdev->hw_features;
1221 1252
1222 if (adapter->pci_using_dac) { 1253 if (adapter->pci_using_dac) {
1223 netdev->features |= NETIF_F_HIGHDMA; 1254 netdev->features |= NETIF_F_HIGHDMA;
@@ -1225,10 +1256,12 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
1225 } 1256 }
1226 1257
1227 if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX) 1258 if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX)
1228 netdev->features |= (NETIF_F_HW_VLAN_TX); 1259 netdev->hw_features |= NETIF_F_HW_VLAN_TX;
1229 1260
1230 if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) 1261 if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
1231 netdev->features |= NETIF_F_LRO; 1262 netdev->hw_features |= NETIF_F_LRO;
1263
1264 netdev->features |= netdev->hw_features;
1232 1265
1233 netdev->irq = adapter->msix_entries[0].vector; 1266 netdev->irq = adapter->msix_entries[0].vector;
1234 1267