aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-06 22:43:48 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-07 23:16:57 -0400
commit6332c8d3a5e352fae854cbcac764622e083461e5 (patch)
tree7ee794566dacb78150064e89e753d925af6e32b1 /drivers/net/benet
parente92702b1046a418a562878b22f92433517760921 (diff)
net: benet: convert to hw_features
Simple conversion. This also fixes a bug in TX checksum toggling --- driver was changing NETIF_F_HW_CSUM instead of NETIF_F_IP_CSUM+NETIF_F_IPV6_CSUM. 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/benet')
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_ethtool.c27
-rw-r--r--drivers/net/benet/be_main.c19
3 files changed, 10 insertions, 37 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index d2c42f5d5e9e..a0b4743d7224 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -307,7 +307,6 @@ struct be_adapter {
307 u16 work_counter; 307 u16 work_counter;
308 308
309 /* Ethtool knobs and info */ 309 /* Ethtool knobs and info */
310 bool rx_csum; /* BE card must perform rx-checksumming */
311 char fw_ver[FW_VER_LEN]; 310 char fw_ver[FW_VER_LEN];
312 u32 if_handle; /* Used to configure filtering */ 311 u32 if_handle; /* Used to configure filtering */
313 u32 pmac_id; /* MAC addr handle used by BE card */ 312 u32 pmac_id; /* MAC addr handle used by BE card */
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 1565c81ff96c..96f5502e0ef7 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -261,25 +261,6 @@ be_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
261 return 0; 261 return 0;
262} 262}
263 263
264static u32 be_get_rx_csum(struct net_device *netdev)
265{
266 struct be_adapter *adapter = netdev_priv(netdev);
267
268 return adapter->rx_csum;
269}
270
271static int be_set_rx_csum(struct net_device *netdev, uint32_t data)
272{
273 struct be_adapter *adapter = netdev_priv(netdev);
274
275 if (data)
276 adapter->rx_csum = true;
277 else
278 adapter->rx_csum = false;
279
280 return 0;
281}
282
283static void 264static void
284be_get_ethtool_stats(struct net_device *netdev, 265be_get_ethtool_stats(struct net_device *netdev,
285 struct ethtool_stats *stats, uint64_t *data) 266 struct ethtool_stats *stats, uint64_t *data)
@@ -760,14 +741,6 @@ const struct ethtool_ops be_ethtool_ops = {
760 .get_ringparam = be_get_ringparam, 741 .get_ringparam = be_get_ringparam,
761 .get_pauseparam = be_get_pauseparam, 742 .get_pauseparam = be_get_pauseparam,
762 .set_pauseparam = be_set_pauseparam, 743 .set_pauseparam = be_set_pauseparam,
763 .get_rx_csum = be_get_rx_csum,
764 .set_rx_csum = be_set_rx_csum,
765 .get_tx_csum = ethtool_op_get_tx_csum,
766 .set_tx_csum = ethtool_op_set_tx_hw_csum,
767 .get_sg = ethtool_op_get_sg,
768 .set_sg = ethtool_op_set_sg,
769 .get_tso = ethtool_op_get_tso,
770 .set_tso = ethtool_op_set_tso,
771 .get_strings = be_get_stat_strings, 744 .get_strings = be_get_stat_strings,
772 .set_phys_id = be_set_phys_id, 745 .set_phys_id = be_set_phys_id,
773 .get_sset_count = be_get_sset_count, 746 .get_sset_count = be_get_sset_count,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index b8831403400c..58a652f81862 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -988,9 +988,10 @@ static void be_rx_compl_process(struct be_adapter *adapter,
988 struct be_rx_obj *rxo, 988 struct be_rx_obj *rxo,
989 struct be_rx_compl_info *rxcp) 989 struct be_rx_compl_info *rxcp)
990{ 990{
991 struct net_device *netdev = adapter->netdev;
991 struct sk_buff *skb; 992 struct sk_buff *skb;
992 993
993 skb = netdev_alloc_skb_ip_align(adapter->netdev, BE_HDR_LEN); 994 skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
994 if (unlikely(!skb)) { 995 if (unlikely(!skb)) {
995 if (net_ratelimit()) 996 if (net_ratelimit())
996 dev_warn(&adapter->pdev->dev, "skb alloc failed\n"); 997 dev_warn(&adapter->pdev->dev, "skb alloc failed\n");
@@ -1000,13 +1001,13 @@ static void be_rx_compl_process(struct be_adapter *adapter,
1000 1001
1001 skb_fill_rx_data(adapter, rxo, skb, rxcp); 1002 skb_fill_rx_data(adapter, rxo, skb, rxcp);
1002 1003
1003 if (likely(adapter->rx_csum && csum_passed(rxcp))) 1004 if (likely((netdev->features & NETIF_F_RXCSUM) && csum_passed(rxcp)))
1004 skb->ip_summed = CHECKSUM_UNNECESSARY; 1005 skb->ip_summed = CHECKSUM_UNNECESSARY;
1005 else 1006 else
1006 skb_checksum_none_assert(skb); 1007 skb_checksum_none_assert(skb);
1007 1008
1008 skb->truesize = skb->len + sizeof(struct sk_buff); 1009 skb->truesize = skb->len + sizeof(struct sk_buff);
1009 skb->protocol = eth_type_trans(skb, adapter->netdev); 1010 skb->protocol = eth_type_trans(skb, netdev);
1010 if (adapter->netdev->features & NETIF_F_RXHASH) 1011 if (adapter->netdev->features & NETIF_F_RXHASH)
1011 skb->rxhash = rxcp->rss_hash; 1012 skb->rxhash = rxcp->rss_hash;
1012 1013
@@ -2627,10 +2628,12 @@ static void be_netdev_init(struct net_device *netdev)
2627 struct be_rx_obj *rxo; 2628 struct be_rx_obj *rxo;
2628 int i; 2629 int i;
2629 2630
2630 netdev->features |= NETIF_F_SG | NETIF_F_HW_VLAN_RX | NETIF_F_TSO | 2631 netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
2631 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | 2632 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
2632 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2633
2633 NETIF_F_GRO | NETIF_F_TSO6; 2634 netdev->features |= netdev->hw_features |
2635 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX |
2636 NETIF_F_HW_VLAN_FILTER;
2634 2637
2635 if (be_multi_rxq(adapter)) 2638 if (be_multi_rxq(adapter))
2636 netdev->features |= NETIF_F_RXHASH; 2639 netdev->features |= NETIF_F_RXHASH;
@@ -2643,8 +2646,6 @@ static void be_netdev_init(struct net_device *netdev)
2643 2646
2644 netdev->flags |= IFF_MULTICAST; 2647 netdev->flags |= IFF_MULTICAST;
2645 2648
2646 adapter->rx_csum = true;
2647
2648 /* Default settings for Rx and Tx flow control */ 2649 /* Default settings for Rx and Tx flow control */
2649 adapter->rx_fc = true; 2650 adapter->rx_fc = true;
2650 adapter->tx_fc = true; 2651 adapter->tx_fc = true;