aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c109
1 files changed, 28 insertions, 81 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 05ddfb18d5b..0a52079bafe 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3174,7 +3174,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3174 } 3174 }
3175 3175
3176 skb_checksum_none_assert(skb); 3176 skb_checksum_none_assert(skb);
3177 if (bp->rx_csum && 3177 if ((bp->dev->features & NETIF_F_RXCSUM) &&
3178 (status & (L2_FHDR_STATUS_TCP_SEGMENT | 3178 (status & (L2_FHDR_STATUS_TCP_SEGMENT |
3179 L2_FHDR_STATUS_UDP_DATAGRAM))) { 3179 L2_FHDR_STATUS_UDP_DATAGRAM))) {
3180 3180
@@ -7189,38 +7189,6 @@ bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
7189 return 0; 7189 return 0;
7190} 7190}
7191 7191
7192static u32
7193bnx2_get_rx_csum(struct net_device *dev)
7194{
7195 struct bnx2 *bp = netdev_priv(dev);
7196
7197 return bp->rx_csum;
7198}
7199
7200static int
7201bnx2_set_rx_csum(struct net_device *dev, u32 data)
7202{
7203 struct bnx2 *bp = netdev_priv(dev);
7204
7205 bp->rx_csum = data;
7206 return 0;
7207}
7208
7209static int
7210bnx2_set_tso(struct net_device *dev, u32 data)
7211{
7212 struct bnx2 *bp = netdev_priv(dev);
7213
7214 if (data) {
7215 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
7216 if (CHIP_NUM(bp) == CHIP_NUM_5709)
7217 dev->features |= NETIF_F_TSO6;
7218 } else
7219 dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6 |
7220 NETIF_F_TSO_ECN);
7221 return 0;
7222}
7223
7224static struct { 7192static struct {
7225 char string[ETH_GSTRING_LEN]; 7193 char string[ETH_GSTRING_LEN];
7226} bnx2_stats_str_arr[] = { 7194} bnx2_stats_str_arr[] = {
@@ -7532,43 +7500,37 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state)
7532 return 0; 7500 return 0;
7533} 7501}
7534 7502
7535static int 7503static u32
7536bnx2_set_tx_csum(struct net_device *dev, u32 data) 7504bnx2_fix_features(struct net_device *dev, u32 features)
7537{ 7505{
7538 struct bnx2 *bp = netdev_priv(dev); 7506 struct bnx2 *bp = netdev_priv(dev);
7539 7507
7540 if (CHIP_NUM(bp) == CHIP_NUM_5709) 7508 if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
7541 return ethtool_op_set_tx_ipv6_csum(dev, data); 7509 features |= NETIF_F_HW_VLAN_RX;
7542 else 7510
7543 return ethtool_op_set_tx_csum(dev, data); 7511 return features;
7544} 7512}
7545 7513
7546static int 7514static int
7547bnx2_set_flags(struct net_device *dev, u32 data) 7515bnx2_set_features(struct net_device *dev, u32 features)
7548{ 7516{
7549 struct bnx2 *bp = netdev_priv(dev); 7517 struct bnx2 *bp = netdev_priv(dev);
7550 int rc;
7551
7552 if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) &&
7553 !(data & ETH_FLAG_RXVLAN))
7554 return -EINVAL;
7555 7518
7556 /* TSO with VLAN tag won't work with current firmware */ 7519 /* TSO with VLAN tag won't work with current firmware */
7557 if (!(data & ETH_FLAG_TXVLAN)) 7520 if (features & NETIF_F_HW_VLAN_TX)
7558 return -EINVAL; 7521 dev->vlan_features |= (dev->hw_features & NETIF_F_ALL_TSO);
7559 7522 else
7560 rc = ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH | ETH_FLAG_RXVLAN | 7523 dev->vlan_features &= ~NETIF_F_ALL_TSO;
7561 ETH_FLAG_TXVLAN);
7562 if (rc)
7563 return rc;
7564 7524
7565 if ((!!(data & ETH_FLAG_RXVLAN) != 7525 if ((!!(features & NETIF_F_HW_VLAN_RX) !=
7566 !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && 7526 !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) &&
7567 netif_running(dev)) { 7527 netif_running(dev)) {
7568 bnx2_netif_stop(bp, false); 7528 bnx2_netif_stop(bp, false);
7529 dev->features = features;
7569 bnx2_set_rx_mode(dev); 7530 bnx2_set_rx_mode(dev);
7570 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); 7531 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1);
7571 bnx2_netif_start(bp, false); 7532 bnx2_netif_start(bp, false);
7533 return 1;
7572 } 7534 }
7573 7535
7574 return 0; 7536 return 0;
@@ -7593,18 +7555,11 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
7593 .set_ringparam = bnx2_set_ringparam, 7555 .set_ringparam = bnx2_set_ringparam,
7594 .get_pauseparam = bnx2_get_pauseparam, 7556 .get_pauseparam = bnx2_get_pauseparam,
7595 .set_pauseparam = bnx2_set_pauseparam, 7557 .set_pauseparam = bnx2_set_pauseparam,
7596 .get_rx_csum = bnx2_get_rx_csum,
7597 .set_rx_csum = bnx2_set_rx_csum,
7598 .set_tx_csum = bnx2_set_tx_csum,
7599 .set_sg = ethtool_op_set_sg,
7600 .set_tso = bnx2_set_tso,
7601 .self_test = bnx2_self_test, 7558 .self_test = bnx2_self_test,
7602 .get_strings = bnx2_get_strings, 7559 .get_strings = bnx2_get_strings,
7603 .set_phys_id = bnx2_set_phys_id, 7560 .set_phys_id = bnx2_set_phys_id,
7604 .get_ethtool_stats = bnx2_get_ethtool_stats, 7561 .get_ethtool_stats = bnx2_get_ethtool_stats,
7605 .get_sset_count = bnx2_get_sset_count, 7562 .get_sset_count = bnx2_get_sset_count,
7606 .set_flags = bnx2_set_flags,
7607 .get_flags = ethtool_op_get_flags,
7608}; 7563};
7609 7564
7610/* Called with rtnl_lock */ 7565/* Called with rtnl_lock */
@@ -8116,8 +8071,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
8116 bp->tx_ring_size = MAX_TX_DESC_CNT; 8071 bp->tx_ring_size = MAX_TX_DESC_CNT;
8117 bnx2_set_rx_ring_size(bp, 255); 8072 bnx2_set_rx_ring_size(bp, 255);
8118 8073
8119 bp->rx_csum = 1;
8120
8121 bp->tx_quick_cons_trip_int = 2; 8074 bp->tx_quick_cons_trip_int = 2;
8122 bp->tx_quick_cons_trip = 20; 8075 bp->tx_quick_cons_trip = 20;
8123 bp->tx_ticks_int = 18; 8076 bp->tx_ticks_int = 18;
@@ -8309,17 +8262,14 @@ static const struct net_device_ops bnx2_netdev_ops = {
8309 .ndo_validate_addr = eth_validate_addr, 8262 .ndo_validate_addr = eth_validate_addr,
8310 .ndo_set_mac_address = bnx2_change_mac_addr, 8263 .ndo_set_mac_address = bnx2_change_mac_addr,
8311 .ndo_change_mtu = bnx2_change_mtu, 8264 .ndo_change_mtu = bnx2_change_mtu,
8265 .ndo_fix_features = bnx2_fix_features,
8266 .ndo_set_features = bnx2_set_features,
8312 .ndo_tx_timeout = bnx2_tx_timeout, 8267 .ndo_tx_timeout = bnx2_tx_timeout,
8313#ifdef CONFIG_NET_POLL_CONTROLLER 8268#ifdef CONFIG_NET_POLL_CONTROLLER
8314 .ndo_poll_controller = poll_bnx2, 8269 .ndo_poll_controller = poll_bnx2,
8315#endif 8270#endif
8316}; 8271};
8317 8272
8318static inline void vlan_features_add(struct net_device *dev, u32 flags)
8319{
8320 dev->vlan_features |= flags;
8321}
8322
8323static int __devinit 8273static int __devinit
8324bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 8274bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8325{ 8275{
@@ -8359,20 +8309,17 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8359 memcpy(dev->dev_addr, bp->mac_addr, 6); 8309 memcpy(dev->dev_addr, bp->mac_addr, 6);
8360 memcpy(dev->perm_addr, bp->mac_addr, 6); 8310 memcpy(dev->perm_addr, bp->mac_addr, 6);
8361 8311
8362 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_GRO | 8312 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
8363 NETIF_F_RXHASH; 8313 NETIF_F_TSO | NETIF_F_TSO_ECN |
8364 vlan_features_add(dev, NETIF_F_IP_CSUM | NETIF_F_SG); 8314 NETIF_F_RXHASH | NETIF_F_RXCSUM;
8365 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 8315
8366 dev->features |= NETIF_F_IPV6_CSUM; 8316 if (CHIP_NUM(bp) == CHIP_NUM_5709)
8367 vlan_features_add(dev, NETIF_F_IPV6_CSUM); 8317 dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
8368 } 8318
8369 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 8319 dev->vlan_features = dev->hw_features;
8370 dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN; 8320 dev->hw_features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
8371 vlan_features_add(dev, NETIF_F_TSO | NETIF_F_TSO_ECN); 8321 dev->features |= dev->hw_features;
8372 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 8322
8373 dev->features |= NETIF_F_TSO6;
8374 vlan_features_add(dev, NETIF_F_TSO6);
8375 }
8376 if ((rc = register_netdev(dev))) { 8323 if ((rc = register_netdev(dev))) {
8377 dev_err(&pdev->dev, "Cannot register net device\n"); 8324 dev_err(&pdev->dev, "Cannot register net device\n");
8378 goto error; 8325 goto error;