netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: benet: convert to hw_features
@ 2011-04-07 12:43 Michał Mirosław
  2011-04-07 21:35 ` Ajit.Khaparde
  2011-04-08  3:18 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michał Mirosław @ 2011-04-07 12:43 UTC (permalink / raw)
  To: netdev; +Cc: Sathya Perla, Subbu Seetharaman, Ajit Khaparde

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>
---
 drivers/net/benet/be.h         |    1 -
 drivers/net/benet/be_ethtool.c |   27 ---------------------------
 drivers/net/benet/be_main.c    |   19 ++++++++++---------
 3 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 0899d91..30d52b0 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -309,7 +309,6 @@ struct be_adapter {
 	u16 work_counter;
 
 	/* Ethtool knobs and info */
-	bool rx_csum; 		/* BE card must perform rx-checksumming */
 	char fw_ver[FW_VER_LEN];
 	u32 if_handle;		/* Used to configure filtering */
 	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 a665697..bc8ba8d 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)
 	return 0;
 }
 
-static u32 be_get_rx_csum(struct net_device *netdev)
-{
-	struct be_adapter *adapter = netdev_priv(netdev);
-
-	return adapter->rx_csum;
-}
-
-static int be_set_rx_csum(struct net_device *netdev, uint32_t data)
-{
-	struct be_adapter *adapter = netdev_priv(netdev);
-
-	if (data)
-		adapter->rx_csum = true;
-	else
-		adapter->rx_csum = false;
-
-	return 0;
-}
-
 static void
 be_get_ethtool_stats(struct net_device *netdev,
 		struct ethtool_stats *stats, uint64_t *data)
@@ -748,14 +729,6 @@ const struct ethtool_ops be_ethtool_ops = {
 	.get_ringparam = be_get_ringparam,
 	.get_pauseparam = be_get_pauseparam,
 	.set_pauseparam = be_set_pauseparam,
-	.get_rx_csum = be_get_rx_csum,
-	.set_rx_csum = be_set_rx_csum,
-	.get_tx_csum = ethtool_op_get_tx_csum,
-	.set_tx_csum = ethtool_op_set_tx_hw_csum,
-	.get_sg = ethtool_op_get_sg,
-	.set_sg = ethtool_op_set_sg,
-	.get_tso = ethtool_op_get_tso,
-	.set_tso = ethtool_op_set_tso,
 	.get_strings = be_get_stat_strings,
 	.set_phys_id = be_set_phys_id,
 	.get_sset_count = be_get_sset_count,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a24fb45..41816a7 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -993,9 +993,10 @@ static void be_rx_compl_process(struct be_adapter *adapter,
 			struct be_rx_obj *rxo,
 			struct be_rx_compl_info *rxcp)
 {
+	struct net_device *netdev = adapter->netdev;
 	struct sk_buff *skb;
 
-	skb = netdev_alloc_skb_ip_align(adapter->netdev, BE_HDR_LEN);
+	skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
 	if (unlikely(!skb)) {
 		if (net_ratelimit())
 			dev_warn(&adapter->pdev->dev, "skb alloc failed\n");
@@ -1005,13 +1006,13 @@ static void be_rx_compl_process(struct be_adapter *adapter,
 
 	skb_fill_rx_data(adapter, rxo, skb, rxcp);
 
-	if (likely(adapter->rx_csum && csum_passed(rxcp)))
+	if (likely((netdev->features & NETIF_F_RXCSUM) && csum_passed(rxcp)))
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 	else
 		skb_checksum_none_assert(skb);
 
 	skb->truesize = skb->len + sizeof(struct sk_buff);
-	skb->protocol = eth_type_trans(skb, adapter->netdev);
+	skb->protocol = eth_type_trans(skb, netdev);
 
 	if (unlikely(rxcp->vlanf)) {
 		if (!adapter->vlan_grp || adapter->vlans_added == 0) {
@@ -2609,10 +2610,12 @@ static void be_netdev_init(struct net_device *netdev)
 	struct be_rx_obj *rxo;
 	int i;
 
-	netdev->features |= NETIF_F_SG | NETIF_F_HW_VLAN_RX | NETIF_F_TSO |
-		NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER |
-		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_GRO | NETIF_F_TSO6;
+	netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
+		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
+
+	netdev->features |= netdev->hw_features |
+		NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX |
+		NETIF_F_HW_VLAN_FILTER;
 
 	netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
@@ -2622,8 +2625,6 @@ static void be_netdev_init(struct net_device *netdev)
 
 	netdev->flags |= IFF_MULTICAST;
 
-	adapter->rx_csum = true;
-
 	/* Default settings for Rx and Tx flow control */
 	adapter->rx_fc = true;
 	adapter->tx_fc = true;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] net: benet: convert to hw_features
  2011-04-07 12:43 [PATCH] net: benet: convert to hw_features Michał Mirosław
@ 2011-04-07 21:35 ` Ajit.Khaparde
  2011-04-08  3:18 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ajit.Khaparde @ 2011-04-07 21:35 UTC (permalink / raw)
  To: mirq-linux, netdev; +Cc: Sathya.Perla, subbu.seetharaman

________________________________________
From: Michał Mirosław [mirq-linux@rere.qmqm.pl]
Sent: Thursday, April 07, 2011 7:43 AM
To: netdev@vger.kernel.org
Cc: Perla, Sathya; Seetharaman, Subramanian; Khaparde, Ajit
Subject: [PATCH] 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

Acked-by: Ajit Khaparde <ajit.khaparde@emulex.com>

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: benet: convert to hw_features
  2011-04-07 12:43 [PATCH] net: benet: convert to hw_features Michał Mirosław
  2011-04-07 21:35 ` Ajit.Khaparde
@ 2011-04-08  3:18 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-04-08  3:18 UTC (permalink / raw)
  To: mirq-linux; +Cc: netdev, sathya.perla, subbu.seetharaman, ajit.khaparde

From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Thu,  7 Apr 2011 14:43:48 +0200 (CEST)

> 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>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-08  3:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-07 12:43 [PATCH] net: benet: convert to hw_features Michał Mirosław
2011-04-07 21:35 ` Ajit.Khaparde
2011-04-08  3:18 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).