netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: buytenh@marvell.com, netdev@vger.kernel.org
Subject: Re: [PATCH 4/8] dsa: convert to net_device_ops
Date: Tue, 6 Jan 2009 14:51:43 -0800	[thread overview]
Message-ID: <20090106145143.5f18ee5b@extreme> (raw)
In-Reply-To: <20090106.104344.130715147.davem@davemloft.net>

Subject: dsa: convert to net_device_ops (v2)

Convert this driver to use net_device_ops

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/net/dsa/slave.c	2009-01-06 14:16:05.760509806 -0800
+++ b/net/dsa/slave.c	2009-01-06 14:24:07.632360799 -0800
@@ -286,6 +286,42 @@ static const struct ethtool_ops dsa_slav
 	.get_sset_count		= dsa_slave_get_sset_count,
 };
 
+#ifdef CONFIG_NET_DSA_TAG_DSA
+static const struct net_device_ops dsa_netdev_ops = {
+	.ndo_open	 	= dsa_slave_open,
+	.ndo_stop		= dsa_slave_close,
+	.ndo_start_xmit		= dsa_xmit,
+	.ndo_change_rx_flags	= dsa_slave_change_rx_flags,
+	.ndo_set_rx_mode	= dsa_slave_set_rx_mode,
+	.ndo_set_multicast_list = dsa_slave_set_rx_mode,
+	.ndo_set_mac_address	= dsa_slave_set_mac_address,
+	.ndo_do_ioctl		= dsa_slave_ioctl,
+};
+#endif
+#ifdef CONFIG_NET_DSA_TAG_EDSA
+static const struct net_device_ops edsa_netdev_ops = {
+	.ndo_open	 	= dsa_slave_open,
+	.ndo_stop		= dsa_slave_close,
+	.ndo_start_xmit		= edsa_xmit,
+	.ndo_change_rx_flags	= dsa_slave_change_rx_flags,
+	.ndo_set_rx_mode	= dsa_slave_set_rx_mode,
+	.ndo_set_multicast_list = dsa_slave_set_rx_mode,
+	.ndo_set_mac_address	= dsa_slave_set_mac_address,
+	.ndo_do_ioctl		= dsa_slave_ioctl,
+};
+#endif
+#ifdef CONFIG_NET_DSA_TAG_TRAILER
+static const struct net_device_ops trailer_netdev_ops = {
+	.ndo_open	 	= dsa_slave_open,
+	.ndo_stop		= dsa_slave_close,
+	.ndo_start_xmit		= trailer_xmit,
+	.ndo_change_rx_flags	= dsa_slave_change_rx_flags,
+	.ndo_set_rx_mode	= dsa_slave_set_rx_mode,
+	.ndo_set_multicast_list = dsa_slave_set_rx_mode,
+	.ndo_set_mac_address	= dsa_slave_set_mac_address,
+	.ndo_do_ioctl		= dsa_slave_ioctl,
+};
+#endif
 
 /* slave device setup *******************************************************/
 struct net_device *
@@ -306,32 +342,27 @@ dsa_slave_create(struct dsa_switch *ds, 
 	SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops);
 	memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN);
 	slave_dev->tx_queue_len = 0;
+
 	switch (ds->tag_protocol) {
 #ifdef CONFIG_NET_DSA_TAG_DSA
 	case htons(ETH_P_DSA):
-		slave_dev->hard_start_xmit = dsa_xmit;
+		slave_dev->netdev_ops = &dsa_netdev_ops;
 		break;
 #endif
 #ifdef CONFIG_NET_DSA_TAG_EDSA
 	case htons(ETH_P_EDSA):
-		slave_dev->hard_start_xmit = edsa_xmit;
+		slave_dev->netdev_ops = &edsa_netdev_ops;
 		break;
 #endif
 #ifdef CONFIG_NET_DSA_TAG_TRAILER
 	case htons(ETH_P_TRAILER):
-		slave_dev->hard_start_xmit = trailer_xmit;
+		slave_dev->netdev_ops = &trailer_netdev_ops;
 		break;
 #endif
 	default:
 		BUG();
 	}
-	slave_dev->open = dsa_slave_open;
-	slave_dev->stop = dsa_slave_close;
-	slave_dev->change_rx_flags = dsa_slave_change_rx_flags;
-	slave_dev->set_rx_mode = dsa_slave_set_rx_mode;
-	slave_dev->set_multicast_list = dsa_slave_set_rx_mode;
-	slave_dev->set_mac_address = dsa_slave_set_mac_address;
-	slave_dev->do_ioctl = dsa_slave_ioctl;
+
 	SET_NETDEV_DEV(slave_dev, parent);
 	slave_dev->vlan_features = master->vlan_features;
 

  reply	other threads:[~2009-01-06 22:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 20:14 [PATCH 0/8] More net_device ops Stephen Hemminger
2009-01-05 20:14 ` [PATCH 2/8] bonding: use net_device_ops Stephen Hemminger
2009-01-06 18:42   ` David Miller
2009-01-05 20:14 ` [PATCH 3/8] wireless: convert wireless ioctl to net_device_ops Stephen Hemminger
     [not found]   ` <20090105201514.442703045-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2009-01-06 18:42     ` David Miller
2009-01-05 20:14 ` [PATCH 4/8] dsa: convert " Stephen Hemminger
     [not found]   ` <20090106060705.GG4414@server.marvell.com>
2009-01-06 18:43     ` David Miller
2009-01-06 22:51       ` Stephen Hemminger [this message]
2009-01-07  0:45         ` David Miller
2009-01-05 20:14 ` [PATCH 5/8] virtio: " Stephen Hemminger
2009-01-06  9:40   ` Mark McLoughlin
2009-01-06 18:44     ` David Miller
2009-01-05 20:14 ` [PATCH 6/8] xen-netfront: " Stephen Hemminger
2009-01-06  0:17   ` Jeremy Fitzhardinge
2009-01-06 18:45   ` David Miller
2009-01-05 20:14 ` [PATCH 7/8] infiniband: driver API update Stephen Hemminger
2009-01-05 21:02   ` Roland Dreier
2009-01-05 21:22     ` [ofa-general] [PATCH 1/3] infiniband: amso100 convert to net_device_ops Stephen Hemminger
2009-01-05 21:22       ` [ofa-general] [PATCH 2/3] infiniband: nes_nic " Stephen Hemminger
2009-01-05 21:23         ` [ofa-general] [PATCH 3/3] infiniband: ipoib " Stephen Hemminger
2009-01-06  5:07           ` Roland Dreier
2009-01-06 18:46             ` [ofa-general] " David Miller
2009-01-06 18:45     ` [ofa-general] Re: [PATCH 7/8] infiniband: driver API update David Miller
2009-01-05 20:14 ` [PATCH 8/8] sch_teql: convert to net_device_ops Stephen Hemminger
2009-01-06 18:46   ` David Miller
     [not found] ` <20090105201514.192918670@vyatta.com>
2009-01-06 18:41   ` [PATCH 1/8] irda: convert to internal stats David Miller

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=20090106145143.5f18ee5b@extreme \
    --to=shemminger@vyatta.com \
    --cc=buytenh@marvell.com \
    --cc=davem@davemloft.net \
    --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 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).