All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: netdev@vger.kernel.org
Cc: Ben Hutchings <bhutchings@solarflare.com>
Subject: [PATCH v2 15/16] veth: convert to hw_features
Date: Sat, 22 Jan 2011 23:14:14 +0100 (CET)	[thread overview]
Message-ID: <fd6de7dadb1127fdd3ab7abdf695937ae4ccfe11.1295734271.git.mirq-linux@rere.qmqm.pl> (raw)
In-Reply-To: <cover.1295734270.git.mirq-linux@rere.qmqm.pl>

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/veth.c |   45 +++++----------------------------------------
 1 files changed, 5 insertions(+), 40 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index cc83fa7..b4d0349 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -36,7 +36,6 @@ struct veth_net_stats {
 struct veth_priv {
 	struct net_device *peer;
 	struct veth_net_stats __percpu *stats;
-	unsigned ip_summed;
 };
 
 /*
@@ -99,47 +98,10 @@ static void veth_get_ethtool_stats(struct net_device *dev,
 	data[0] = priv->peer->ifindex;
 }
 
-static u32 veth_get_rx_csum(struct net_device *dev)
-{
-	struct veth_priv *priv;
-
-	priv = netdev_priv(dev);
-	return priv->ip_summed == CHECKSUM_UNNECESSARY;
-}
-
-static int veth_set_rx_csum(struct net_device *dev, u32 data)
-{
-	struct veth_priv *priv;
-
-	priv = netdev_priv(dev);
-	priv->ip_summed = data ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
-	return 0;
-}
-
-static u32 veth_get_tx_csum(struct net_device *dev)
-{
-	return (dev->features & NETIF_F_NO_CSUM) != 0;
-}
-
-static int veth_set_tx_csum(struct net_device *dev, u32 data)
-{
-	if (data)
-		dev->features |= NETIF_F_NO_CSUM;
-	else
-		dev->features &= ~NETIF_F_NO_CSUM;
-	return 0;
-}
-
 static const struct ethtool_ops veth_ethtool_ops = {
 	.get_settings		= veth_get_settings,
 	.get_drvinfo		= veth_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
-	.get_rx_csum		= veth_get_rx_csum,
-	.set_rx_csum		= veth_set_rx_csum,
-	.get_tx_csum		= veth_get_tx_csum,
-	.set_tx_csum		= veth_set_tx_csum,
-	.get_sg			= ethtool_op_get_sg,
-	.set_sg			= ethtool_op_set_sg,
 	.get_strings		= veth_get_strings,
 	.get_sset_count		= veth_get_sset_count,
 	.get_ethtool_stats	= veth_get_ethtool_stats,
@@ -168,8 +130,9 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* don't change ip_summed == CHECKSUM_PARTIAL, as that
 	   will cause bad checksum on forwarded packets */
-	if (skb->ip_summed == CHECKSUM_NONE)
-		skb->ip_summed = rcv_priv->ip_summed;
+	if (skb->ip_summed == CHECKSUM_NONE &&
+	    rcv->features & NETIF_F_RXCSUM)
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 	length = skb->len + ETH_HLEN;
 	if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)
@@ -304,6 +267,8 @@ static void veth_setup(struct net_device *dev)
 	dev->ethtool_ops = &veth_ethtool_ops;
 	dev->features |= NETIF_F_LLTX;
 	dev->destructor = veth_dev_free;
+
+	dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
 }
 
 /*
-- 
1.7.2.3


  parent reply	other threads:[~2011-01-22 22:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-22 22:14 [PATCH v2 00/16] net: Unified offload configuration Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 03/16] net: reduce and unify printk level in netdev_fix_features() Michał Mirosław
2011-01-22 23:12   ` Joe Perches
2011-01-22 23:40     ` Michał Mirosław
2011-01-23 12:44       ` [PATCH] " Michał Mirosław
2011-01-22 23:48   ` [PATCH v2 03/16] " Michał Mirosław
2011-01-24 23:45   ` David Miller
2011-01-22 22:14 ` [PATCH v2 01/16] net: Move check of checksum features to netdev_fix_features() Michał Mirosław
2011-01-24 23:29   ` David Miller
2011-01-22 22:14 ` [PATCH v2 02/16] net: change netdev->features to u32 Michał Mirosław
2011-01-23 10:35   ` Eric Dumazet
2011-01-23 12:44     ` [PATCH] " Michał Mirosław
2011-01-24 23:30   ` [PATCH v2 02/16] " David Miller
2011-01-25 11:07     ` Michał Mirosław
2011-01-25 20:37       ` David Miller
2011-01-22 22:14 ` [PATCH v2 08/16] loopback: convert to hw_features Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 12/16] jme: convert offload constraints to ndo_fix_features Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 05/16] net: ethtool: use ndo_fix_features for offload setting Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 11/16] bonding: convert to ndo_fix_features Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 06/16] net: use ndo_fix_features for ethtool_ops->set_flags Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 10/16] vlan: convert VLAN devices to use ndo_fix_features() Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 09/16] bridge: convert br_features_recompute() to ndo_fix_features Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 04/16] net: Introduce new feature setting ops Michał Mirosław
2011-01-24 23:51   ` David Miller
2011-01-25  1:26     ` Ben Hutchings
2011-01-22 22:14 ` [PATCH v2 07/16] net: introduce NETIF_F_RXCSUM Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 13/16] virtio_net: convert to ndo_fix_features Michał Mirosław
2011-01-22 22:14 ` Michał Mirosław [this message]
2011-01-22 22:14 ` [PATCH v2 16/16] skge: convert to hw_features Michał Mirosław
2011-01-31 16:45   ` Stephen Hemminger
2011-01-31 21:53     ` Michał Mirosław
2011-01-31 22:40       ` Michał Mirosław
2011-01-31 23:08       ` Michał Mirosław
2011-01-22 22:14 ` [PATCH v2 14/16] Intel net drivers: convert to ndo_fix_features Michał Mirosław
2011-01-24  7:06   ` Jeff Kirsher
2011-01-26  9:47   ` Jeff Kirsher
2011-04-07 12:51     ` Michał Mirosław
2011-04-07 15:00       ` Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd6de7dadb1127fdd3ab7abdf695937ae4ccfe11.1295734271.git.mirq-linux@rere.qmqm.pl \
    --to=mirq-linux@rere.qmqm.pl \
    --cc=bhutchings@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.