Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 02/21] net: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
From: Joe Perches @ 2012-10-19  3:55 UTC (permalink / raw)
  To: Patrick McHardy, Marek Lindner, Simon Wunderlich,
	Antonio Quartulli, Stephen Hemminger, David S. Miller,
	Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	John W. Linville, Johannes Berg, Jesse Gross
  Cc: dev-yBygre7rU0TnMu66kgdUjQ,
	bridge-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1350618006.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

Convert the old ether_addr tests to eth_addr_<foo>.
Adds api consistency.

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 net/802/stp.c                          |    4 +-
 net/8021q/vlan_dev.c                   |    6 ++--
 net/8021q/vlan_netlink.c               |    2 +-
 net/batman-adv/bat_iv_ogm.c            |    2 +-
 net/batman-adv/bridge_loop_avoidance.c |    8 ++--
 net/batman-adv/routing.c               |   20 ++++++------
 net/batman-adv/soft-interface.c        |    4 +-
 net/batman-adv/unicast.c               |    2 +-
 net/batman-adv/vis.c                   |    4 +-
 net/bridge/br_device.c                 |    6 ++--
 net/bridge/br_fdb.c                    |    2 +-
 net/bridge/br_if.c                     |    2 +-
 net/bridge/br_input.c                  |    8 ++--
 net/bridge/br_netlink.c                |    2 +-
 net/core/pktgen.c                      |    4 +-
 net/core/rtnetlink.c                   |    2 +-
 net/dsa/slave.c                        |    2 +-
 net/ethernet/eth.c                     |    6 ++--
 net/ipv4/ip_gre.c                      |    2 +-
 net/ipv6/ip6_gre.c                     |    2 +-
 net/mac80211/cfg.c                     |    2 +-
 net/mac80211/ibss.c                    |    8 ++--
 net/mac80211/ieee80211_i.h             |    2 +-
 net/mac80211/iface.c                   |   12 ++++----
 net/mac80211/mesh.c                    |    2 +-
 net/mac80211/mesh_hwmp.c               |    4 +-
 net/mac80211/mesh_pathtbl.c            |    4 +-
 net/mac80211/mesh_plink.c              |    2 +-
 net/mac80211/mlme.c                    |    4 +-
 net/mac80211/rx.c                      |   50 ++++++++++++++++----------------
 net/mac80211/sta_info.c                |    2 +-
 net/mac80211/status.c                  |    6 ++--
 net/mac80211/tx.c                      |   22 +++++++-------
 net/mac80211/wme.c                     |    4 +-
 net/openvswitch/flow.c                 |    4 +-
 net/openvswitch/vport-internal_dev.c   |    2 +-
 net/wireless/core.c                    |    2 +-
 net/wireless/ibss.c                    |    2 +-
 net/wireless/nl80211.c                 |    4 +-
 net/wireless/util.c                    |    4 +-
 net/wireless/wext-compat.c             |    2 +-
 net/wireless/wext-sme.c                |    2 +-
 42 files changed, 118 insertions(+), 118 deletions(-)

diff --git a/net/802/stp.c b/net/802/stp.c
index 2c40ba0..80a253c 100644
--- a/net/802/stp.c
+++ b/net/802/stp.c
@@ -74,7 +74,7 @@ int stp_proto_register(const struct stp_proto *proto)
 			goto out;
 		}
 	}
-	if (is_zero_ether_addr(proto->group_address))
+	if (eth_addr_zero(proto->group_address))
 		rcu_assign_pointer(stp_proto, proto);
 	else
 		rcu_assign_pointer(garp_protos[proto->group_address[5] -
@@ -88,7 +88,7 @@ EXPORT_SYMBOL_GPL(stp_proto_register);
 void stp_proto_unregister(const struct stp_proto *proto)
 {
 	mutex_lock(&stp_proto_mutex);
-	if (is_zero_ether_addr(proto->group_address))
+	if (eth_addr_zero(proto->group_address))
 		RCU_INIT_POINTER(stp_proto, NULL);
 	else
 		RCU_INIT_POINTER(garp_protos[proto->group_address[5] -
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4024424..5c330c9 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -352,7 +352,7 @@ static int vlan_dev_set_mac_address(struct net_device *dev, void *p)
 	struct sockaddr *addr = p;
 	int err;
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
 	if (!(dev->flags & IFF_UP))
@@ -559,9 +559,9 @@ static int vlan_dev_init(struct net_device *dev)
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
 
-	if (is_zero_ether_addr(dev->dev_addr))
+	if (eth_addr_zero(dev->dev_addr))
 		memcpy(dev->dev_addr, real_dev->dev_addr, dev->addr_len);
-	if (is_zero_ether_addr(dev->broadcast))
+	if (eth_addr_zero(dev->broadcast))
 		memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
 
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 708c80e..c79bba9 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -46,7 +46,7 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[])
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
 			return -EINVAL;
-		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+		if (!eth_addr_valid(nla_data(tb[IFLA_ADDRESS])))
 			return -EADDRNOTAVAIL;
 	}
 
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index b02b75d..5e07dbc 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1056,7 +1056,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
 				       hard_iface->net_dev->dev_addr))
 			is_my_oldorig = 1;
 
-		if (is_broadcast_ether_addr(ethhdr->h_source))
+		if (eth_addr_broadcast(ethhdr->h_source))
 			is_broadcast = 1;
 	}
 	rcu_read_unlock();
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index fd8d5af..719faa6 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1425,7 +1425,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid,
 
 	if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
 		/* don't allow broadcasts while requests are in flight */
-		if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
+		if (eth_addr_multicast(ethhdr->h_dest) && is_bcast)
 			goto handled;
 
 	memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN);
@@ -1451,7 +1451,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid,
 	}
 
 	/* if it is a broadcast ... */
-	if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {
+	if (eth_addr_multicast(ethhdr->h_dest) && is_bcast) {
 		/* ... drop it. the responsible gateway is in charge.
 		 *
 		 * We need to check is_bcast because with the gateway
@@ -1524,7 +1524,7 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid)
 
 	if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
 		/* don't allow broadcasts while requests are in flight */
-		if (is_multicast_ether_addr(ethhdr->h_dest))
+		if (eth_addr_multicast(ethhdr->h_dest))
 			goto handled;
 
 	memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN);
@@ -1549,7 +1549,7 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid)
 	}
 
 	/* check if it is a multicast/broadcast frame */
-	if (is_multicast_ether_addr(ethhdr->h_dest)) {
+	if (eth_addr_multicast(ethhdr->h_dest)) {
 		/* drop it. the responsible gateway has forwarded it into
 		 * the backbone network.
 		 */
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 376b4cc..69357da 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -261,11 +261,11 @@ bool batadv_check_management_packet(struct sk_buff *skb,
 	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* packet with broadcast indication but unicast recipient */
-	if (!is_broadcast_ether_addr(ethhdr->h_dest))
+	if (!eth_addr_broadcast(ethhdr->h_dest))
 		return false;
 
 	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	if (eth_addr_broadcast(ethhdr->h_source))
 		return false;
 
 	/* create a copy of the skb, if needed, to modify it. */
@@ -412,11 +412,11 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
 	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* packet with unicast indication but broadcast recipient */
-	if (is_broadcast_ether_addr(ethhdr->h_dest))
+	if (eth_addr_broadcast(ethhdr->h_dest))
 		goto out;
 
 	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	if (eth_addr_broadcast(ethhdr->h_source))
 		goto out;
 
 	/* not for me */
@@ -590,11 +590,11 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
 	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* packet with unicast indication but broadcast recipient */
-	if (is_broadcast_ether_addr(ethhdr->h_dest))
+	if (eth_addr_broadcast(ethhdr->h_dest))
 		return -1;
 
 	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	if (eth_addr_broadcast(ethhdr->h_source))
 		return -1;
 
 	/* not for me */
@@ -697,11 +697,11 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
 	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* packet with unicast indication but broadcast recipient */
-	if (is_broadcast_ether_addr(ethhdr->h_dest))
+	if (eth_addr_broadcast(ethhdr->h_dest))
 		goto out;
 
 	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	if (eth_addr_broadcast(ethhdr->h_source))
 		goto out;
 
 	batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
@@ -1077,11 +1077,11 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
 	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* packet with broadcast indication but unicast recipient */
-	if (!is_broadcast_ether_addr(ethhdr->h_dest))
+	if (!eth_addr_broadcast(ethhdr->h_dest))
 		goto out;
 
 	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	if (eth_addr_broadcast(ethhdr->h_source))
 		goto out;
 
 	/* ignore broadcasts sent by myself */
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index b9a28d2..a08fe2f 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -109,7 +109,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
 	struct sockaddr *addr = p;
 	uint8_t old_addr[ETH_ALEN];
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
 	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
@@ -184,7 +184,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
 	if (batadv_compare_eth(ethhdr->h_dest, stp_addr))
 		goto dropped;
 
-	if (is_multicast_ether_addr(ethhdr->h_dest)) {
+	if (eth_addr_multicast(ethhdr->h_dest)) {
 		do_bcast = true;
 
 		switch (atomic_read(&bat_priv->gw_mode)) {
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index f397232..e0538e2 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -302,7 +302,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv)
 	unsigned int dev_mtu;
 
 	/* get routing information */
-	if (is_multicast_ether_addr(ethhdr->h_dest)) {
+	if (eth_addr_multicast(ethhdr->h_dest)) {
 		orig_node = batadv_gw_get_selected_orig(bat_priv);
 		if (orig_node)
 			goto find_router;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 5abd145..55c1025 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -476,7 +476,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv,
 	int are_target = 0;
 
 	/* clients shall not broadcast. */
-	if (is_broadcast_ether_addr(vis_packet->target_orig))
+	if (eth_addr_broadcast(vis_packet->target_orig))
 		return;
 
 	/* Are we the target for this VIS packet? */
@@ -800,7 +800,7 @@ static void batadv_send_vis_packet(struct batadv_priv *bat_priv,
 	memcpy(packet->sender_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
 	packet->header.ttl--;
 
-	if (is_broadcast_ether_addr(packet->target_orig))
+	if (eth_addr_broadcast(packet->target_orig))
 		batadv_broadcast_vis_packet(bat_priv, info);
 	else
 		batadv_unicast_vis_packet(bat_priv, info);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 070e8a6..9963b31 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -50,9 +50,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 	skb_reset_mac_header(skb);
 	skb_pull(skb, ETH_HLEN);
 
-	if (is_broadcast_ether_addr(dest))
+	if (eth_addr_broadcast(dest))
 		br_flood_deliver(br, skb);
-	else if (is_multicast_ether_addr(dest)) {
+	else if (eth_addr_multicast(dest)) {
 		if (unlikely(netpoll_tx_running(dev))) {
 			br_flood_deliver(br, skb);
 			goto out;
@@ -167,7 +167,7 @@ static int br_set_mac_address(struct net_device *dev, void *p)
 	struct net_bridge *br = netdev_priv(dev);
 	struct sockaddr *addr = p;
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
 	spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index d9576e6..5519242 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -374,7 +374,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 	struct hlist_head *head = &br->hash[br_mac_hash(addr)];
 	struct net_bridge_fdb_entry *fdb;
 
-	if (!is_valid_ether_addr(addr))
+	if (!eth_addr_valid(addr))
 		return -EINVAL;
 
 	fdb = fdb_find(head, addr);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1c8fdc3..b21cfc3 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -327,7 +327,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 	/* Don't allow bridging non-ethernet like devices */
 	if ((dev->flags & IFF_LOOPBACK) ||
 	    dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN ||
-	    !is_valid_ether_addr(dev->dev_addr))
+	    !eth_addr_valid(dev->dev_addr))
 		return -EINVAL;
 
 	/* No bridging of bridges */
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 76f15fd..c084fed 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -61,7 +61,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
 	br = p->br;
 	br_fdb_update(br, p, eth_hdr(skb)->h_source);
 
-	if (!is_broadcast_ether_addr(dest) && is_multicast_ether_addr(dest) &&
+	if (!eth_addr_broadcast(dest) && eth_addr_multicast(dest) &&
 	    br_multicast_rcv(br, p, skb))
 		goto drop;
 
@@ -78,9 +78,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
 
 	dst = NULL;
 
-	if (is_broadcast_ether_addr(dest))
+	if (eth_addr_broadcast(dest))
 		skb2 = skb;
-	else if (is_multicast_ether_addr(dest)) {
+	else if (eth_addr_multicast(dest)) {
 		mdst = br_mdb_get(br, skb);
 		if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
 			if ((mdst && mdst->mglist) ||
@@ -153,7 +153,7 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
 	if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
 		return RX_HANDLER_PASS;
 
-	if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
+	if (!eth_addr_valid(eth_hdr(skb)->h_source))
 		goto drop;
 
 	skb = skb_share_check(skb, GFP_ATOMIC);
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 093f527..e6b7916 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -201,7 +201,7 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
 			return -EINVAL;
-		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+		if (!eth_addr_valid(nla_data(tb[IFLA_ADDRESS])))
 			return -EADDRNOTAVAIL;
 	}
 
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d1dc14c..3422af7 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -573,7 +573,7 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
 	seq_puts(seq, "     src_mac: ");
 
 	seq_printf(seq, "%pM ",
-		   is_zero_ether_addr(pkt_dev->src_mac) ?
+		   eth_addr_zero(pkt_dev->src_mac) ?
 			     pkt_dev->odev->dev_addr : pkt_dev->src_mac);
 
 	seq_printf(seq, "dst_mac: ");
@@ -2028,7 +2028,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
 
 	/* Default to the interface's mac if not explicitly set. */
 
-	if (is_zero_ether_addr(pkt_dev->src_mac))
+	if (eth_addr_zero(pkt_dev->src_mac))
 		memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN);
 
 	/* Set up Dest MAC */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 76d4c2c..5f2632f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2079,7 +2079,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 	}
 
 	addr = nla_data(tb[NDA_LLADDR]);
-	if (!is_valid_ether_addr(addr)) {
+	if (!eth_addr_valid(addr)) {
 		pr_info("PF_BRIDGE: RTM_NEWNEIGH with invalid ether address\n");
 		return -EINVAL;
 	}
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e32083d..c2eaa8e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -140,7 +140,7 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
 	struct sockaddr *addr = a;
 	int err;
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
 	if (!(dev->flags & IFF_UP))
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 4efad53..5ebd114 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -163,7 +163,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	skb_pull_inline(skb, ETH_HLEN);
 	eth = eth_hdr(skb);
 
-	if (unlikely(is_multicast_ether_addr(eth->h_dest))) {
+	if (unlikely(eth_addr_multicast(eth->h_dest))) {
 		if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
 			skb->pkt_type = PACKET_BROADCAST;
 		else
@@ -287,7 +287,7 @@ int eth_mac_addr(struct net_device *dev, void *p)
 
 	if (!(dev->priv_flags & IFF_LIVE_ADDR_CHANGE) && netif_running(dev))
 		return -EBUSY;
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
 	/* if device marked as NET_ADDR_RANDOM, reset it */
@@ -315,7 +315,7 @@ EXPORT_SYMBOL(eth_change_mtu);
 
 int eth_validate_addr(struct net_device *dev)
 {
-	if (!is_valid_ether_addr(dev->dev_addr))
+	if (!eth_addr_valid(dev->dev_addr))
 		return -EADDRNOTAVAIL;
 
 	return 0;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 7240f8e..dd94879 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1502,7 +1502,7 @@ static int ipgre_tap_validate(struct nlattr *tb[], struct nlattr *data[])
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
 			return -EINVAL;
-		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+		if (!eth_addr_valid(nla_data(tb[IFLA_ADDRESS])))
 			return -EADDRNOTAVAIL;
 	}
 
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 0185679..7f1810d 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1453,7 +1453,7 @@ static int ip6gre_tap_validate(struct nlattr *tb[], struct nlattr *data[])
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
 			return -EINVAL;
-		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+		if (!eth_addr_valid(nla_data(tb[IFLA_ADDRESS])))
 			return -EADDRNOTAVAIL;
 	}
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 05f3a31..28cc1b0 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1193,7 +1193,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 	if (ether_addr_equal(mac, sdata->vif.addr))
 		return -EINVAL;
 
-	if (is_multicast_ether_addr(mac))
+	if (eth_addr_multicast(mac))
 		return -EINVAL;
 
 	sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 5f3620f..cd6c03a 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -747,7 +747,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
 		bssid = ifibss->bssid;
 	if (ifibss->fixed_channel)
 		chan = ifibss->channel;
-	if (!is_zero_ether_addr(ifibss->bssid))
+	if (!eth_addr_zero(ifibss->bssid))
 		bssid = ifibss->bssid;
 	cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
 				ifibss->ssid, ifibss->ssid_len,
@@ -829,11 +829,11 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
 		 "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
 		 mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
 
-	if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
+	if (!tx_last_beacon && eth_addr_multicast(mgmt->da))
 		return;
 
 	if (!ether_addr_equal(mgmt->bssid, ifibss->bssid) &&
-	    !is_broadcast_ether_addr(mgmt->bssid))
+	    !eth_addr_broadcast(mgmt->bssid))
 		return;
 
 	end = ((u8 *) mgmt) + len;
@@ -1157,7 +1157,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 
 	active_ibss = ieee80211_sta_active_ibss(sdata);
 
-	if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
+	if (!active_ibss && !eth_addr_zero(ifibss->bssid)) {
 		capability = WLAN_CAPABILITY_IBSS;
 
 		if (ifibss->privacy)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8c80455..c218341 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1185,7 +1185,7 @@ static inline struct ieee80211_local *hw_to_local(
 static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
 {
 	return ether_addr_equal(raddr, addr) ||
-	       is_broadcast_ether_addr(raddr);
+	       eth_addr_broadcast(raddr);
 }
 
 
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 6f8a73c..6292fa4 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -427,7 +427,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 
 	switch (sdata->vif.type) {
 	case NL80211_IFTYPE_WDS:
-		if (!is_valid_ether_addr(sdata->u.wds.remote_addr))
+		if (!eth_addr_valid(sdata->u.wds.remote_addr))
 			return -ENOLINK;
 		break;
 	case NL80211_IFTYPE_AP_VLAN: {
@@ -482,13 +482,13 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 	 * Copy the hopefully now-present MAC address to
 	 * this interface, if it has the special null one.
 	 */
-	if (dev && is_zero_ether_addr(dev->dev_addr)) {
+	if (dev && eth_addr_zero(dev->dev_addr)) {
 		memcpy(dev->dev_addr,
 		       local->hw.wiphy->perm_addr,
 		       ETH_ALEN);
 		memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
 
-		if (!is_valid_ether_addr(dev->dev_addr)) {
+		if (!eth_addr_valid(dev->dev_addr)) {
 			res = -EADDRNOTAVAIL;
 			goto err_stop;
 		}
@@ -647,7 +647,7 @@ static int ieee80211_open(struct net_device *dev)
 	int err;
 
 	/* fail early if user set an invalid address */
-	if (!is_valid_ether_addr(dev->dev_addr))
+	if (!eth_addr_valid(dev->dev_addr))
 		return -EADDRNOTAVAIL;
 
 	err = ieee80211_check_concurrent_iface(sdata, sdata->vif.type);
@@ -1320,7 +1320,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
 	/* default ... something at least */
 	memcpy(perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
 
-	if (is_zero_ether_addr(local->hw.wiphy->addr_mask) &&
+	if (eth_addr_zero(local->hw.wiphy->addr_mask) &&
 	    local->hw.wiphy->n_addresses <= 1)
 		return;
 
@@ -1376,7 +1376,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
 		}
 
 		/* try mask if available */
-		if (is_zero_ether_addr(local->hw.wiphy->addr_mask))
+		if (eth_addr_zero(local->hw.wiphy->addr_mask))
 			break;
 
 		m = local->hw.wiphy->addr_mask;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ff0296c..60bdef7 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -473,7 +473,7 @@ void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh)
 int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
 				  const u8 *meshda, const u8 *meshsa)
 {
-	if (is_multicast_ether_addr(meshda)) {
+	if (eth_addr_multicast(meshda)) {
 		*fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
 		/* DA TA SA */
 		memcpy(hdr->addr1, meshda, ETH_ALEN);
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 47aeee2..46c162b 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -539,7 +539,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 			target_sn = ++ifmsh->sn;
 			ifmsh->last_sn_update = jiffies;
 		}
-	} else if (is_broadcast_ether_addr(target_addr) &&
+	} else if (eth_addr_broadcast(target_addr) &&
 		   (target_flags & IEEE80211_PREQ_TO_FLAG)) {
 		rcu_read_lock();
 		mpath = mesh_path_lookup(orig_addr, sdata);
@@ -621,7 +621,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 				hopcount, ttl, cpu_to_le32(lifetime),
 				cpu_to_le32(metric), cpu_to_le32(preq_id),
 				sdata);
-		if (!is_multicast_ether_addr(da))
+		if (!eth_addr_multicast(da))
 			ifmsh->mshstats.fwded_unicast++;
 		else
 			ifmsh->mshstats.fwded_mcast++;
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index aa74981..e86a6e4 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -510,7 +510,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
 		/* never add ourselves as neighbours */
 		return -ENOTSUPP;
 
-	if (is_multicast_ether_addr(dst))
+	if (eth_addr_multicast(dst))
 		return -ENOTSUPP;
 
 	if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0)
@@ -645,7 +645,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
 		/* never add ourselves as neighbours */
 		return -ENOTSUPP;
 
-	if (is_multicast_ether_addr(dst))
+	if (eth_addr_multicast(dst))
 		return -ENOTSUPP;
 
 	err = -ENOMEM;
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 3ab34d8..3b327d6 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -594,7 +594,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
 	if (len < IEEE80211_MIN_ACTION_SIZE + 3)
 		return;
 
-	if (is_multicast_ether_addr(mgmt->da)) {
+	if (eth_addr_multicast(mgmt->da)) {
 		mpl_dbg(sdata,
 			"Mesh plink: ignore frame from multicast address\n");
 		return;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e714ed8..b0f2d64 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -423,7 +423,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
 	memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
 	memcpy(mgmt->bssid, assoc_data->bss->bssid, ETH_ALEN);
 
-	if (!is_zero_ether_addr(assoc_data->prev_bssid)) {
+	if (!eth_addr_zero(assoc_data->prev_bssid)) {
 		skb_put(skb, 10);
 		mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 						  IEEE80211_STYPE_REASSOC_REQ);
@@ -1491,7 +1491,7 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
 	 * data idle periods for sending the periodic probe request to the
 	 * AP we're connected to.
 	 */
-	if (is_multicast_ether_addr(hdr->addr1))
+	if (eth_addr_multicast(hdr->addr1))
 		return;
 
 	ieee80211_sta_reset_conn_monitor(sdata);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 61c621e..8b79842 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -457,7 +457,7 @@ static int ieee80211_is_unicast_robust_mgmt_frame(struct sk_buff *skb)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 
-	if (skb->len < 24 || is_multicast_ether_addr(hdr->addr1))
+	if (skb->len < 24 || eth_addr_multicast(hdr->addr1))
 		return 0;
 
 	return ieee80211_is_robust_mgmt_frame(hdr);
@@ -468,7 +468,7 @@ static int ieee80211_is_multicast_robust_mgmt_frame(struct sk_buff *skb)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 
-	if (skb->len < 24 || !is_multicast_ether_addr(hdr->addr1))
+	if (skb->len < 24 || !eth_addr_multicast(hdr->addr1))
 		return 0;
 
 	return ieee80211_is_robust_mgmt_frame(hdr);
@@ -482,7 +482,7 @@ static int ieee80211_get_mmie_keyidx(struct sk_buff *skb)
 	struct ieee80211_mmie *mmie;
 
 	if (skb->len < 24 + sizeof(*mmie) ||
-	    !is_multicast_ether_addr(hdr->da))
+	    !eth_addr_multicast(hdr->da))
 		return -1;
 
 	if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *) hdr))
@@ -505,7 +505,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 	char *dev_addr = rx->sdata->vif.addr;
 
 	if (ieee80211_is_data(hdr->frame_control)) {
-		if (is_multicast_ether_addr(hdr->addr1)) {
+		if (eth_addr_multicast(hdr->addr1)) {
 			if (ieee80211_has_tods(hdr->frame_control) ||
 				!ieee80211_has_fromds(hdr->frame_control))
 				return RX_DROP_MONITOR;
@@ -841,7 +841,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
 
 	/* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
-	if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
+	if (rx->sta && !eth_addr_multicast(hdr->addr1)) {
 		if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
 			     rx->sta->last_seq_ctrl[rx->seqno_idx] ==
 			     hdr->seq_ctrl)) {
@@ -965,7 +965,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
 	if (!ieee80211_has_protected(fc))
 		mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb);
 
-	if (!is_multicast_ether_addr(hdr->addr1) && sta_ptk) {
+	if (!eth_addr_multicast(hdr->addr1) && sta_ptk) {
 		rx->key = sta_ptk;
 		if ((status->flag & RX_FLAG_DECRYPTED) &&
 		    (status->flag & RX_FLAG_IV_STRIPPED))
@@ -998,7 +998,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
 		int i;
 
 		if (ieee80211_is_mgmt(fc) &&
-		    is_multicast_ether_addr(hdr->addr1) &&
+		    eth_addr_multicast(hdr->addr1) &&
 		    (key = rcu_dereference(rx->sdata->default_mgmt_key)))
 			rx->key = key;
 		else {
@@ -1048,7 +1048,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
 		keyidx = keyid >> 6;
 
 		/* check per-station GTK first, if multicast packet */
-		if (is_multicast_ether_addr(hdr->addr1) && rx->sta)
+		if (eth_addr_multicast(hdr->addr1) && rx->sta)
 			rx->key = rcu_dereference(rx->sta->gtk[keyidx]);
 
 		/* if not found, try default key */
@@ -1063,7 +1063,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
 			if (rx->key &&
 			    rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP40 &&
 			    rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP104 &&
-			    !is_multicast_ether_addr(hdr->addr1))
+			    !eth_addr_multicast(hdr->addr1))
 				rx->key = NULL;
 		}
 	}
@@ -1290,7 +1290,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 				sta->last_rx_rate_flag = status->flag;
 			}
 		}
-	} else if (!is_multicast_ether_addr(hdr->addr1)) {
+	} else if (!eth_addr_multicast(hdr->addr1)) {
 		/*
 		 * Mesh beacons will update last_rx when if they are found to
 		 * match the current local configuration when processed.
@@ -1467,7 +1467,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
 
 	if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
 		   (rx->skb)->len < 24 ||
-		   is_multicast_ether_addr(hdr->addr1))) {
+		   eth_addr_multicast(hdr->addr1))) {
 		/* not fragmented */
 		goto out;
 	}
@@ -1563,7 +1563,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
  out:
 	if (rx->sta)
 		rx->sta->rx_packets++;
-	if (is_multicast_ether_addr(hdr->addr1))
+	if (eth_addr_multicast(hdr->addr1))
 		rx->local->dot11MulticastReceivedFrameCount++;
 	else
 		ieee80211_led_rx(rx->local);
@@ -1680,7 +1680,7 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)
 			check_port_control = true;
 	}
 
-	if (is_multicast_ether_addr(hdr->addr1) &&
+	if (eth_addr_multicast(hdr->addr1) &&
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta)
 		return -1;
 
@@ -1743,7 +1743,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 	    !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
 	    (status->rx_flags & IEEE80211_RX_RA_MATCH) &&
 	    (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) {
-		if (is_multicast_ether_addr(ehdr->h_dest)) {
+		if (eth_addr_multicast(ehdr->h_dest)) {
 			/*
 			 * send multicast frames both to higher layers in
 			 * local net stack and back to the wireless medium
@@ -1839,7 +1839,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
 	    !rx->sdata->u.vlan.sta)
 		return RX_DROP_UNUSABLE;
 
-	if (is_multicast_ether_addr(hdr->addr1) &&
+	if (eth_addr_multicast(hdr->addr1) &&
 	    ((rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
 	      rx->sdata->u.vlan.sta) ||
 	     (rx->sdata->vif.type == NL80211_IFTYPE_STATION &&
@@ -1893,7 +1893,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
 	/* frame is in RMC, don't forward */
 	if (ieee80211_is_data(hdr->frame_control) &&
-	    is_multicast_ether_addr(hdr->addr1) &&
+	    eth_addr_multicast(hdr->addr1) &&
 	    mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata))
 		return RX_DROP_MONITOR;
 
@@ -1908,7 +1908,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		char *proxied_addr;
 		char *mpp_addr;
 
-		if (is_multicast_ether_addr(hdr->addr1)) {
+		if (eth_addr_multicast(hdr->addr1)) {
 			mpp_addr = hdr->addr3;
 			proxied_addr = mesh_hdr->eaddr1;
 		} else {
@@ -1930,7 +1930,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	}
 
 	/* Frame has reached destination.  Don't forward */
-	if (!is_multicast_ether_addr(hdr->addr1) &&
+	if (!eth_addr_multicast(hdr->addr1) &&
 	    ether_addr_equal(sdata->vif.addr, hdr->addr3))
 		return RX_CONTINUE;
 
@@ -1965,7 +1965,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
 	info->control.vif = &rx->sdata->vif;
 	info->control.jiffies = jiffies;
-	if (is_multicast_ether_addr(fwd_hdr->addr1)) {
+	if (eth_addr_multicast(fwd_hdr->addr1)) {
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
 		memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
 	} else if (!mesh_nexthop_lookup(fwd_skb, sdata)) {
@@ -1982,7 +1982,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
 	ieee80211_add_pending_skb(local, fwd_skb);
  out:
-	if (is_multicast_ether_addr(hdr->addr1) ||
+	if (eth_addr_multicast(hdr->addr1) ||
 	    sdata->dev->flags & IFF_PROMISC)
 		return RX_CONTINUE;
 	else
@@ -2041,7 +2041,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 	dev->stats.rx_bytes += rx->skb->len;
 
 	if (local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 &&
-	    !is_multicast_ether_addr(
+	    !eth_addr_multicast(
 		    ((struct ethhdr *)rx->skb->data)->h_dest) &&
 	    (!local->scanning &&
 	     !test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))) {
@@ -2461,7 +2461,7 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)
 	     sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
 		return RX_DROP_MONITOR;
 
-	if (is_multicast_ether_addr(mgmt->da))
+	if (eth_addr_multicast(mgmt->da))
 		return RX_DROP_MONITOR;
 
 	/* do not return rejected action frames */
@@ -2509,8 +2509,8 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
 	case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
 	case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
 	case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
-		if (is_multicast_ether_addr(mgmt->da) &&
-		    !is_broadcast_ether_addr(mgmt->da))
+		if (eth_addr_multicast(mgmt->da) &&
+		    !eth_addr_broadcast(mgmt->da))
 			return RX_DROP_MONITOR;
 
 		/* process only for station */
@@ -2762,7 +2762,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
 	struct sk_buff *skb = rx->skb;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 	u8 *bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
-	int multicast = is_multicast_ether_addr(hdr->addr1);
+	int multicast = eth_addr_multicast(hdr->addr1);
 
 	switch (sdata->vif.type) {
 	case NL80211_IFTYPE_STATION:
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 797dd36..430db47 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -364,7 +364,7 @@ static int sta_info_insert_check(struct sta_info *sta)
 		return -ENETDOWN;
 
 	if (WARN_ON(ether_addr_equal(sta->sta.addr, sdata->vif.addr) ||
-		    is_multicast_ether_addr(sta->sta.addr)))
+		    eth_addr_multicast(sta->sta.addr)))
 		return -EINVAL;
 
 	return 0;
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 3af0cc4..04ba926 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -288,7 +288,7 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band
 	/* IEEE80211_RADIOTAP_TX_FLAGS */
 	txflags = 0;
 	if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
-	    !is_multicast_ether_addr(hdr->addr1))
+	    !eth_addr_multicast(hdr->addr1))
 		txflags |= IEEE80211_RADIOTAP_F_TX_FAIL;
 
 	if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
@@ -482,7 +482,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 	if (info->flags & IEEE80211_TX_STAT_ACK) {
 		if (ieee80211_is_first_frag(hdr->seq_ctrl)) {
 			local->dot11TransmittedFrameCount++;
-			if (is_multicast_ether_addr(hdr->addr1))
+			if (eth_addr_multicast(hdr->addr1))
 				local->dot11MulticastTransmittedFrameCount++;
 			if (retry_count > 0)
 				local->dot11RetryCount++;
@@ -494,7 +494,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 		 * with an individual address in the address 1 field or an MPDU
 		 * with a multicast address in the address 1 field of type Data
 		 * or Management. */
-		if (!is_multicast_ether_addr(hdr->addr1) ||
+		if (!eth_addr_multicast(hdr->addr1) ||
 		    ieee80211_is_data(fc) ||
 		    ieee80211_is_mgmt(fc))
 			local->dot11TransmittedFragmentCount++;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c9bf83f..c5e251d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -532,14 +532,14 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
 	else if (tx->sta && (key = rcu_dereference(tx->sta->ptk)))
 		tx->key = key;
 	else if (ieee80211_is_mgmt(hdr->frame_control) &&
-		 is_multicast_ether_addr(hdr->addr1) &&
+		 eth_addr_multicast(hdr->addr1) &&
 		 ieee80211_is_robust_mgmt_frame(hdr) &&
 		 (key = rcu_dereference(tx->sdata->default_mgmt_key)))
 		tx->key = key;
-	else if (is_multicast_ether_addr(hdr->addr1) &&
+	else if (eth_addr_multicast(hdr->addr1) &&
 		 (key = rcu_dereference(tx->sdata->default_multicast_key)))
 		tx->key = key;
-	else if (!is_multicast_ether_addr(hdr->addr1) &&
+	else if (!eth_addr_multicast(hdr->addr1) &&
 		 (key = rcu_dereference(tx->sdata->default_unicast_key)))
 		tx->key = key;
 	else if (info->flags & IEEE80211_TX_CTL_INJECTED)
@@ -693,7 +693,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
 			 (info->flags & IEEE80211_TX_CTL_NO_ACK)))
 		info->control.rates[0].count = 1;
 
-	if (is_multicast_ether_addr(hdr->addr1)) {
+	if (eth_addr_multicast(hdr->addr1)) {
 		/*
 		 * XXX: verify the rate is in the basic rateset
 		 */
@@ -1036,7 +1036,7 @@ ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
 			next_len = next->len;
 		} else
 			next_len = 0;
-		group_addr = is_multicast_ether_addr(hdr->addr1);
+		group_addr = eth_addr_multicast(hdr->addr1);
 
 		hdr->duration_id =
 			ieee80211_duration(tx, skb, group_addr, next_len);
@@ -1174,7 +1174,7 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
 		}
 	}
 
-	if (is_multicast_ether_addr(hdr->addr1)) {
+	if (eth_addr_multicast(hdr->addr1)) {
 		tx->flags &= ~IEEE80211_TX_UNICAST;
 		info->flags |= IEEE80211_TX_CTL_NO_ACK;
 	} else
@@ -1475,7 +1475,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
 
 	if (ieee80211_vif_is_mesh(&sdata->vif) &&
 	    ieee80211_is_data(hdr->frame_control) &&
-	    !is_multicast_ether_addr(hdr->addr1) &&
+	    !eth_addr_multicast(hdr->addr1) &&
 	    mesh_nexthop_resolve(skb, sdata)) {
 		/* skb queued: don't free */
 		rcu_read_unlock();
@@ -1787,7 +1787,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 			goto fail;
 		}
 		rcu_read_lock();
-		if (!is_multicast_ether_addr(skb->data)) {
+		if (!eth_addr_multicast(skb->data)) {
 			mpath = mesh_path_lookup(skb->data, sdata);
 			if (!mpath)
 				mppath = mpp_path_lookup(skb->data, sdata);
@@ -1823,7 +1823,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 
 			hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
 					mesh_da, sdata->vif.addr);
-			if (is_multicast_ether_addr(mesh_da))
+			if (eth_addr_multicast(mesh_da))
 				/* DA TA mSA AE:SA */
 				meshhdrlen =
 					ieee80211_new_mesh_header(&mesh_hdr,
@@ -1913,7 +1913,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 	 * if it is a multicast address (which can only happen
 	 * in AP mode)
 	 */
-	multicast = is_multicast_ether_addr(hdr.addr1);
+	multicast = eth_addr_multicast(hdr.addr1);
 	if (!multicast) {
 		rcu_read_lock();
 		sta = sta_info_get(sdata, hdr.addr1);
@@ -1939,7 +1939,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 	 * EAPOL frames from the local station.
 	 */
 	if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) &&
-		     !is_multicast_ether_addr(hdr.addr1) && !authorized &&
+		     !eth_addr_multicast(hdr.addr1) && !authorized &&
 		     (cpu_to_be16(ethertype) != sdata->control_port_protocol ||
 		      !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index cea06e9..f64d446 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -141,7 +141,7 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
 		break;
 	}
 
-	if (!sta && ra && !is_multicast_ether_addr(ra)) {
+	if (!sta && ra && !eth_addr_multicast(ra)) {
 		sta = sta_info_get(sdata, ra);
 		if (sta)
 			qos = test_sta_flag(sta, WLAN_STA_WME);
@@ -176,7 +176,7 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 		/* preserve EOSP bit */
 		ack_policy = *p & IEEE80211_QOS_CTL_EOSP;
 
-		if (is_multicast_ether_addr(hdr->addr1) ||
+		if (eth_addr_multicast(hdr->addr1) ||
 		    sdata->noack_map & BIT(tid)) {
 			ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
 			info->flags |= IEEE80211_TX_CTL_NO_ACK;
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 98c7063..70addfe 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -540,13 +540,13 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,
 			 */
 			if (nd_opt->nd_opt_type == ND_OPT_SOURCE_LL_ADDR
 			    && opt_len == 8) {
-				if (unlikely(!is_zero_ether_addr(key->ipv6.nd.sll)))
+				if (unlikely(!eth_addr_zero(key->ipv6.nd.sll)))
 					goto invalid;
 				memcpy(key->ipv6.nd.sll,
 				    &nd->opt[offset+sizeof(*nd_opt)], ETH_ALEN);
 			} else if (nd_opt->nd_opt_type == ND_OPT_TARGET_LL_ADDR
 				   && opt_len == 8) {
-				if (unlikely(!is_zero_ether_addr(key->ipv6.nd.tll)))
+				if (unlikely(!eth_addr_zero(key->ipv6.nd.tll)))
 					goto invalid;
 				memcpy(key->ipv6.nd.tll,
 				    &nd->opt[offset+sizeof(*nd_opt)], ETH_ALEN);
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 5d460c3..96a02c9 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -67,7 +67,7 @@ static int internal_dev_mac_addr(struct net_device *dev, void *p)
 {
 	struct sockaddr *addr = p;
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!eth_addr_valid(addr->sa_data))
 		return -EADDRNOTAVAIL;
 	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 443d4d7..8048685 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -468,7 +468,7 @@ int wiphy_register(struct wiphy *wiphy)
 		return -EINVAL;
 
 	if (WARN_ON(wiphy->addresses &&
-		    !is_zero_ether_addr(wiphy->perm_addr) &&
+		    !eth_addr_zero(wiphy->perm_addr) &&
 		    memcmp(wiphy->perm_addr, wiphy->addresses[0].addr,
 			   ETH_ALEN)))
 		return -EINVAL;
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index ca5672f..21a7dce 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -479,7 +479,7 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev,
 		return -EINVAL;
 
 	/* automatic mode */
-	if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid))
+	if (eth_addr_zero(bssid) || eth_addr_broadcast(bssid))
 		bssid = NULL;
 
 	/* both automatic */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0418a6d..fe94df8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4630,7 +4630,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
 	bss = nla_nest_start(msg, NL80211_ATTR_BSS);
 	if (!bss)
 		goto nla_put_failure;
-	if ((!is_zero_ether_addr(res->bssid) &&
+	if ((!eth_addr_zero(res->bssid) &&
 	     nla_put(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid)) ||
 	    (res->information_elements && res->len_information_elements &&
 	     nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS,
@@ -5275,7 +5275,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 	if (info->attrs[NL80211_ATTR_MAC]) {
 		ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-		if (!is_valid_ether_addr(ibss.bssid))
+		if (!eth_addr_valid(ibss.bssid))
 			return -EINVAL;
 	}
 	ibss.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
diff --git a/net/wireless/util.c b/net/wireless/util.c
index ef35f4e..b25f934 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -388,7 +388,7 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
 		if ((iftype != NL80211_IFTYPE_STATION &&
 		     iftype != NL80211_IFTYPE_P2P_CLIENT &&
 		     iftype != NL80211_IFTYPE_MESH_POINT) ||
-		    (is_multicast_ether_addr(dst) &&
+		    (eth_addr_multicast(dst) &&
 		     ether_addr_equal(src, addr)))
 			return -1;
 		if (iftype == NL80211_IFTYPE_MESH_POINT) {
@@ -739,7 +739,7 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev)
 		wdev_lock(wdev);
 		switch (ev->type) {
 		case EVENT_CONNECT_RESULT:
-			if (!is_zero_ether_addr(ev->cr.bssid))
+			if (!eth_addr_zero(ev->cr.bssid))
 				bssid = ev->cr.bssid;
 			__cfg80211_connect_result(
 				wdev->netdev, bssid,
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 494379e..dcc9501 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -724,7 +724,7 @@ static int cfg80211_wext_siwencodeext(struct net_device *dev,
 	}
 
 	addr = ext->addr.sa_data;
-	if (is_broadcast_ether_addr(addr))
+	if (eth_addr_broadcast(addr))
 		addr = NULL;
 
 	memset(&params, 0, sizeof(params));
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 1f773f6..4f2f6d8 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -267,7 +267,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
 		return -EINVAL;
 
 	/* automatic mode */
-	if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid))
+	if (eth_addr_zero(bssid) || eth_addr_broadcast(bssid))
 		bssid = NULL;
 
 	cfg80211_lock_rdev(rdev);
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* [PATCH net-next 01/21] etherdevice: Rename is_<foo>_ether_addr tests to eth_addr_<foo>
From: Joe Perches @ 2012-10-19  3:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev
In-Reply-To: <cover.1350618006.git.joe@perches.com>

Make the ether_addr tests use a similar style to ipv6_<foo> tests.
Add backward compatibility #defines to keep current is_<foo>_ether_addr
code working until completely converted.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/etherdevice.h |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b006ba0..969efa5 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -52,63 +52,63 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
 #define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
 
 /**
- * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
+ * eth_addr_zero - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is all zeroes.
  */
-static inline bool is_zero_ether_addr(const u8 *addr)
+static inline bool eth_addr_zero(const u8 *addr)
 {
 	return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
 }
 
 /**
- * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
+ * eth_addr_multicast - Determine if the Ethernet address is a multicast.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a multicast address.
  * By definition the broadcast address is also a multicast address.
  */
-static inline bool is_multicast_ether_addr(const u8 *addr)
+static inline bool eth_addr_multicast(const u8 *addr)
 {
 	return 0x01 & addr[0];
 }
 
 /**
- * is_local_ether_addr - Determine if the Ethernet address is locally-assigned one (IEEE 802).
+ * eth_addr_local - Determine if the Ethernet address is locally-assigned one (IEEE 802).
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a local address.
  */
-static inline bool is_local_ether_addr(const u8 *addr)
+static inline bool eth_addr_local(const u8 *addr)
 {
 	return 0x02 & addr[0];
 }
 
 /**
- * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
+ * eth_addr_broadcast - Determine if the Ethernet address is broadcast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is the broadcast address.
  */
-static inline bool is_broadcast_ether_addr(const u8 *addr)
+static inline bool eth_addr_broadcast(const u8 *addr)
 {
 	return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
 }
 
 /**
- * is_unicast_ether_addr - Determine if the Ethernet address is unicast
+ * eth_addr_unicast - Determine if the Ethernet address is unicast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a unicast address.
  */
-static inline bool is_unicast_ether_addr(const u8 *addr)
+static inline bool eth_addr_unicast(const u8 *addr)
 {
-	return !is_multicast_ether_addr(addr);
+	return !eth_addr_multicast(addr);
 }
 
 /**
- * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * eth_addr_valid - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
@@ -116,13 +116,21 @@ static inline bool is_unicast_ether_addr(const u8 *addr)
  *
  * Return true if the address is valid.
  */
-static inline bool is_valid_ether_addr(const u8 *addr)
+static inline bool eth_addr_valid(const u8 *addr)
 {
 	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
 	 * explicitly check for it here. */
-	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+	return !eth_addr_multicast(addr) && !eth_addr_zero(addr);
 }
 
+/* Some #defines to make old is_<foo>_ether_addr tests work for awhile */
+#define is_zero_ether_addr(addr)	eth_addr_zero(addr)
+#define is_multicast_ether_addr(addr)	eth_addr_multicast(addr)
+#define is_local_ether_addr(addr)	eth_addr_local(addr)
+#define is_broadcast_ether_addr(addr)	eth_addr_broadcast(addr)
+#define is_unicast_ether_addr(addr)	eth_addr_unicast(addr)
+#define is_valid_ether_addr(addr)	eth_addr_valid(addr)
+
 /**
  * eth_random_addr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* [PATCH net-next 00/21] treewide: Use consistent api style for address testing
From: Joe Perches @ 2012-10-19  3:55 UTC (permalink / raw)
  To: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	e1000-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	cbe-oss-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, wimax-BPSAo7wm5JOHVYUYWc+uSQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	ath9k-devel-xDcbHBWguxHbcTqmT+pZeQ,
	b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-s390-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	bridge-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	netfilter-u79uwXL29TY76Z2rM5mHXA, coreteam-Cap9r6Oaw4JrovVCs/uTlw,
	lvs-devel-u79uwXL29TY76Z2rM5mHXA, dev-yBygre7rU0TnMu66kgdUjQ
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA,
	user-mode-linux-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	user-mode-linux-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

ethernet, ipv4, and ipv6 address testing uses 3 different api naming styles.

ethernet uses:	is_<foo>_ether_addr
ipv4 uses:	ipv4_is_<foo>
ipv6 uses:	ipv6_addr_<foo>

Standardize on the ipv6 style of <prefix>_addr_<type> to reduce
the number of styles to remember.

The new consistent styles are:

eth_addr_<foo>(const u8 *)
ipv4_addr_<foo>(__be32)
ipv6_addr_<foo>(const struct in6_addr *)

Add temporary backward compatibility #defines for the old names too.

Joe Perches (21):
  etherdevice: Rename is_<foo>_ether_addr tests to eth_addr_<foo>
  net: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  arch: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  wireless: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  drivers: net: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  staging: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  infiniband: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  scsi: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  of: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  s390: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  usb: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  uwb: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  Documentation: networking: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  llc_if.h: Convert is_<foo>_ether_addr uses to eth_addr_<foo>
  in.h: Rename ipv4_is_<foo> functions to ipv4_addr_<foo>
  net: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>
  infiniband: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>
  ath6kl: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>
  parisc: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>
  lockd: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>
  sctp: Convert ipv4_is_<foo> uses to ipv4_addr_<foo>

 Documentation/networking/driver.txt                |    2 +-
 arch/arm/mach-davinci/board-mityomapl138.c         |    2 +-
 arch/arm/mach-pxa/colibri-pxa3xx.c                 |    2 +-
 arch/avr32/boards/atngw100/setup.c                 |    2 +-
 arch/avr32/boards/atstk1000/atstk1002.c            |    2 +-
 arch/avr32/boards/favr-32/setup.c                  |    2 +-
 arch/avr32/boards/hammerhead/setup.c               |    2 +-
 arch/avr32/boards/merisc/setup.c                   |    2 +-
 arch/avr32/boards/mimc200/setup.c                  |    2 +-
 arch/mips/alchemy/common/platform.c                |    4 +-
 arch/um/drivers/net_kern.c                         |    6 +-
 drivers/infiniband/core/cma.c                      |    4 +-
 drivers/infiniband/hw/amso1100/c2.c                |    2 +-
 drivers/infiniband/hw/nes/nes_nic.c                |    2 +-
 drivers/net/bonding/bond_3ad.c                     |    2 +-
 drivers/net/bonding/bond_alb.c                     |    2 +-
 drivers/net/bonding/bond_main.c                    |    6 +-
 drivers/net/dummy.c                                |    2 +-
 drivers/net/ethernet/3com/3c59x.c                  |    2 +-
 drivers/net/ethernet/3com/typhoon.c                |    2 +-
 drivers/net/ethernet/8390/etherh.c                 |    2 +-
 drivers/net/ethernet/adi/bfin_mac.c                |    6 +-
 drivers/net/ethernet/aeroflex/greth.c              |    4 +-
 drivers/net/ethernet/amd/au1000_eth.c              |    2 +-
 drivers/net/ethernet/amd/depca.c                   |    4 +-
 drivers/net/ethernet/amd/pcnet32.c                 |    8 ++--
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.c      |    2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c    |    2 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_hw.c      |    4 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c    |    2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c           |   10 ++--
 drivers/net/ethernet/atheros/atlx/atl2.c           |   14 +++---
 drivers/net/ethernet/atheros/atlx/atlx.c           |    2 +-
 drivers/net/ethernet/broadcom/b44.c                |    4 +-
 drivers/net/ethernet/broadcom/bnx2.c               |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |    6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |    4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |    6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c     |    2 +-
 drivers/net/ethernet/broadcom/cnic.c               |    2 +-
 drivers/net/ethernet/broadcom/tg3.c                |    6 +-
 drivers/net/ethernet/brocade/bna/bnad.c            |    6 +-
 drivers/net/ethernet/cadence/at91_ether.c          |    6 +-
 drivers/net/ethernet/cadence/macb.c                |    4 +-
 drivers/net/ethernet/calxeda/xgmac.c               |    6 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c    |    2 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    |    2 +-
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    |    2 +-
 drivers/net/ethernet/cirrus/ep93xx_eth.c           |    2 +-
 drivers/net/ethernet/cirrus/mac89x0.c              |    2 +-
 drivers/net/ethernet/cisco/enic/enic_dev.c         |    4 +-
 drivers/net/ethernet/cisco/enic/enic_main.c        |   10 ++--
 drivers/net/ethernet/cisco/enic/enic_pp.c          |   10 ++--
 drivers/net/ethernet/davicom/dm9000.c              |    6 +-
 drivers/net/ethernet/dec/ewrk3.c                   |    4 +-
 drivers/net/ethernet/dec/tulip/de4x5.c             |    4 +-
 drivers/net/ethernet/dlink/sundance.c              |    2 +-
 drivers/net/ethernet/dnet.c                        |    6 +-
 drivers/net/ethernet/emulex/benet/be_main.c        |    8 ++--
 drivers/net/ethernet/ethoc.c                       |    6 +-
 drivers/net/ethernet/faraday/ftgmac100.c           |    2 +-
 drivers/net/ethernet/faraday/ftmac100.c            |    2 +-
 drivers/net/ethernet/freescale/fec.c               |    8 ++--
 drivers/net/ethernet/freescale/fec_mpc52xx.c       |    2 +-
 drivers/net/ethernet/freescale/gianfar_ethtool.c   |   12 ++--
 drivers/net/ethernet/freescale/ucc_geth.c          |    2 +-
 drivers/net/ethernet/i825xx/ether1.c               |    2 +-
 drivers/net/ethernet/ibm/ehea/ehea_main.c          |    4 +-
 drivers/net/ethernet/intel/e100.c                  |    4 +-
 drivers/net/ethernet/intel/e1000/e1000_main.c      |    4 +-
 drivers/net/ethernet/intel/e1000e/mac.c            |    2 +-
 drivers/net/ethernet/intel/e1000e/netdev.c         |    4 +-
 drivers/net/ethernet/intel/igb/e1000_mac.c         |    2 +-
 drivers/net/ethernet/intel/igb/igb_main.c          |    8 ++--
 drivers/net/ethernet/intel/igbvf/netdev.c          |    6 +-
 drivers/net/ethernet/intel/ixgb/ixgb_hw.c          |    6 +-
 drivers/net/ethernet/intel/ixgb/ixgb_main.c        |    6 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c      |    2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c      |   14 +++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c     |    6 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c  |    8 ++--
 drivers/net/ethernet/lantiq_etop.c                 |    2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c         |    4 +-
 drivers/net/ethernet/marvell/pxa168_eth.c          |    2 +-
 drivers/net/ethernet/marvell/skge.c                |    6 +-
 drivers/net/ethernet/marvell/sky2.c                |    2 +-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c     |    2 +-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |    4 +-
 drivers/net/ethernet/micrel/ks8695net.c            |    6 +-
 drivers/net/ethernet/micrel/ks8842.c               |    4 +-
 drivers/net/ethernet/micrel/ks8851.c               |    4 +-
 drivers/net/ethernet/micrel/ks8851_mll.c           |    2 +-
 drivers/net/ethernet/microchip/enc28j60.c          |    4 +-
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |    2 +-
 drivers/net/ethernet/neterion/s2io.c               |    2 +-
 drivers/net/ethernet/neterion/vxge/vxge-config.c   |    2 +-
 drivers/net/ethernet/neterion/vxge/vxge-main.c     |   12 ++--
 drivers/net/ethernet/netx-eth.c                    |    2 +-
 drivers/net/ethernet/nuvoton/w90p910_ether.c       |    4 +-
 drivers/net/ethernet/nvidia/forcedeth.c            |    4 +-
 drivers/net/ethernet/nxp/lpc_eth.c                 |    8 ++--
 drivers/net/ethernet/octeon/octeon_mgmt.c          |    2 +-
 .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c   |    6 +-
 drivers/net/ethernet/pasemi/pasemi_mac.c           |    4 +-
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |    4 +-
 drivers/net/ethernet/qlogic/qla3xxx.c              |    2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |    4 +-
 drivers/net/ethernet/qlogic/qlge/qlge_main.c       |    6 +-
 drivers/net/ethernet/realtek/8139cp.c              |    2 +-
 drivers/net/ethernet/realtek/8139too.c             |    2 +-
 drivers/net/ethernet/realtek/r8169.c               |    2 +-
 drivers/net/ethernet/renesas/sh_eth.c              |    4 +-
 drivers/net/ethernet/seeq/ether3.c                 |    2 +-
 drivers/net/ethernet/sfc/efx.c                     |    2 +-
 drivers/net/ethernet/sfc/ethtool.c                 |    6 +-
 drivers/net/ethernet/sfc/siena_sriov.c             |    6 +-
 drivers/net/ethernet/sis/sis900.c                  |    2 +-
 drivers/net/ethernet/smsc/smc911x.c                |    4 +-
 drivers/net/ethernet/smsc/smc91x.c                 |    4 +-
 drivers/net/ethernet/smsc/smsc911x.c               |   10 ++--
 drivers/net/ethernet/smsc/smsc9420.c               |    6 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |    4 +-
 drivers/net/ethernet/sun/niu.c                     |    8 ++--
 drivers/net/ethernet/sun/sungem.c                  |    2 +-
 drivers/net/ethernet/ti/cpsw.c                     |    2 +-
 drivers/net/ethernet/ti/davinci_emac.c             |    6 +-
 drivers/net/ethernet/tile/tilegx.c                 |    4 +-
 drivers/net/ethernet/tile/tilepro.c                |    4 +-
 drivers/net/ethernet/toshiba/ps3_gelic_net.c       |    2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c  |    2 +-
 drivers/net/ethernet/toshiba/spider_net.c          |    4 +-
 drivers/net/ethernet/toshiba/tc35815.c             |    4 +-
 drivers/net/ethernet/tundra/tsi108_eth.c           |    8 ++--
 drivers/net/ethernet/via/via-rhine.c               |    2 +-
 drivers/net/ethernet/wiznet/w5100.c                |    6 +-
 drivers/net/ethernet/wiznet/w5300.c                |    6 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c        |    2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c  |    2 +-
 drivers/net/hamradio/bpqether.c                    |    2 +-
 drivers/net/ifb.c                                  |    2 +-
 drivers/net/macvlan.c                              |   16 +++---
 drivers/net/phy/at803x.c                           |    2 +-
 drivers/net/rionet.c                               |    4 +-
 drivers/net/team/team.c                            |    4 +-
 drivers/net/tun.c                                  |    4 +-
 drivers/net/usb/asix_common.c                      |    2 +-
 drivers/net/usb/dm9601.c                           |    4 +-
 drivers/net/usb/mcs7830.c                          |    2 +-
 drivers/net/usb/smsc75xx.c                         |    2 +-
 drivers/net/usb/smsc95xx.c                         |    2 +-
 drivers/net/veth.c                                 |    2 +-
 drivers/net/vxlan.c                                |    4 +-
 drivers/net/wimax/i2400m/driver.c                  |    2 +-
 drivers/net/wireless/adm8211.c                     |    2 +-
 drivers/net/wireless/airo.c                        |    4 +-
 drivers/net/wireless/at76c50x-usb.c                |    8 ++--
 drivers/net/wireless/ath/ath6kl/cfg80211.c         |    8 ++--
 drivers/net/wireless/ath/ath6kl/main.c             |    8 ++--
 drivers/net/wireless/ath/ath6kl/txrx.c             |   10 ++--
 drivers/net/wireless/ath/ath6kl/wmi.c              |    4 +-
 drivers/net/wireless/ath/ath9k/recv.c              |    8 ++--
 drivers/net/wireless/b43/main.c                    |    2 +-
 drivers/net/wireless/b43legacy/main.c              |    2 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |    4 +-
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |    2 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |    2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   16 +++---
 drivers/net/wireless/hostap/hostap_info.c          |    2 +-
 drivers/net/wireless/hostap/hostap_ioctl.c         |    8 ++--
 drivers/net/wireless/hostap/hostap_main.c          |    2 +-
 drivers/net/wireless/ipw2x00/ipw2100.c             |    6 +-
 drivers/net/wireless/ipw2x00/ipw2200.c             |   18 +++---
 drivers/net/wireless/ipw2x00/libipw_rx.c           |   12 ++--
 drivers/net/wireless/ipw2x00/libipw_tx.c           |    4 +-
 drivers/net/wireless/iwlegacy/3945-mac.c           |    2 +-
 drivers/net/wireless/iwlegacy/4965-mac.c           |    2 +-
 drivers/net/wireless/iwlegacy/common.c             |    2 +-
 drivers/net/wireless/iwlwifi/dvm/sta.c             |    2 +-
 drivers/net/wireless/libertas_tf/main.c            |    2 +-
 drivers/net/wireless/mwifiex/join.c                |    2 +-
 drivers/net/wireless/mwifiex/scan.c                |    2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c             |    2 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c         |    2 +-
 drivers/net/wireless/mwifiex/uap_txrx.c            |    2 +-
 drivers/net/wireless/mwl8k.c                       |    2 +-
 drivers/net/wireless/orinoco/wext.c                |    4 +-
 drivers/net/wireless/p54/eeprom.c                  |    2 +-
 drivers/net/wireless/rndis_wlan.c                  |   18 +++---
 drivers/net/wireless/rt2x00/rt2400pci.c            |    2 +-
 drivers/net/wireless/rt2x00/rt2500pci.c            |    2 +-
 drivers/net/wireless/rt2x00/rt2500usb.c            |    2 +-
 drivers/net/wireless/rt2x00/rt2800lib.c            |    8 ++--
 drivers/net/wireless/rt2x00/rt61pci.c              |    2 +-
 drivers/net/wireless/rt2x00/rt73usb.c              |    2 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c         |    4 +-
 drivers/net/wireless/rtl818x/rtl8187/dev.c         |    4 +-
 drivers/net/wireless/rtlwifi/base.c                |    6 +-
 drivers/net/wireless/rtlwifi/cam.c                 |    2 +-
 drivers/net/wireless/rtlwifi/pci.c                 |    8 ++--
 drivers/net/wireless/rtlwifi/rc.c                  |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c       |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c       |    4 +-
 drivers/net/wireless/rtlwifi/usb.c                 |   12 ++--
 drivers/net/wireless/ti/wl1251/main.c              |   12 ++--
 drivers/net/wireless/ti/wlcore/cmd.c               |    2 +-
 drivers/net/wireless/ti/wlcore/main.c              |    6 +-
 drivers/net/wireless/ti/wlcore/tx.c                |    2 +-
 drivers/net/wireless/wl3501_cs.c                   |    2 +-
 drivers/net/wireless/zd1211rw/zd_mac.c             |    2 +-
 drivers/of/of_net.c                                |    6 +-
 drivers/parisc/led.c                               |    2 +-
 drivers/s390/net/qeth_l2_main.c                    |    4 +-
 drivers/scsi/bnx2fc/bnx2fc_els.c                   |    4 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c                  |    2 +-
 drivers/scsi/fcoe/fcoe.c                           |   12 ++--
 drivers/scsi/fcoe/fcoe_ctlr.c                      |    8 ++--
 drivers/scsi/fnic/fnic_fcs.c                       |    6 +-
 drivers/staging/ccg/u_ether.c                      |    6 +-
 drivers/staging/csr/sme_wext.c                     |    2 +-
 drivers/staging/et131x/et131x.c                    |    4 +-
 drivers/staging/gdm72xx/gdm_wimax.c                |    2 +-
 drivers/staging/octeon/ethernet.c                  |    2 +-
 drivers/staging/ozwpan/ozcdev.c                    |    2 +-
 .../rtl8187se/ieee80211/ieee80211_softmac.c        |    2 +-
 .../rtl8187se/ieee80211/ieee80211_softmac_wx.c     |    2 +-
 drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c |    2 +-
 drivers/staging/rtl8187se/r8180_core.c             |    2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |    6 +-
 drivers/staging/rtl8192e/rtl819x_TSProc.c          |    2 +-
 drivers/staging/rtl8192e/rtllib_rx.c               |    8 ++--
 drivers/staging/rtl8192e/rtllib_softmac.c          |    4 +-
 drivers/staging/rtl8192e/rtllib_softmac_wx.c       |    4 +-
 drivers/staging/rtl8192e/rtllib_tx.c               |   12 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |    4 +-
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    2 +-
 .../rtl8192u/ieee80211/ieee80211_softmac_wx.c      |    2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  |   12 ++--
 .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c    |    2 +-
 drivers/staging/rtl8192u/r8192U_core.c             |    8 ++--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c      |    2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_set.c        |    2 +-
 drivers/staging/rtl8712/rtl871x_mlme.c             |    2 +-
 drivers/staging/rtl8712/rtl871x_recv.c             |    8 ++--
 drivers/staging/slicoss/slicoss.c                  |    2 +-
 drivers/staging/vt6655/bssdb.c                     |    2 +-
 drivers/staging/vt6655/card.c                      |    2 +-
 drivers/staging/vt6655/device_main.c               |    2 +-
 drivers/staging/vt6655/dpc.c                       |    4 +-
 drivers/staging/vt6655/hostap.c                    |    4 +-
 drivers/staging/vt6655/iwctl.c                     |    2 +-
 drivers/staging/vt6655/key.c                       |    2 +-
 drivers/staging/vt6655/mib.c                       |    8 ++--
 drivers/staging/vt6655/rxtx.c                      |   10 ++--
 drivers/staging/vt6655/wpactl.c                    |    4 +-
 drivers/staging/vt6656/bssdb.c                     |    2 +-
 drivers/staging/vt6656/dpc.c                       |    4 +-
 drivers/staging/vt6656/hostap.c                    |    4 +-
 drivers/staging/vt6656/iwctl.c                     |    2 +-
 drivers/staging/vt6656/key.c                       |    2 +-
 drivers/staging/vt6656/rxtx.c                      |   14 +++---
 drivers/staging/vt6656/wpactl.c                    |    2 +-
 drivers/staging/wlags49_h2/wl_wext.c               |    2 +-
 drivers/usb/gadget/u_ether.c                       |    6 +-
 drivers/uwb/address.c                              |    2 +-
 include/linux/etherdevice.h                        |   36 ++++++++-----
 include/linux/in.h                                 |   40 ++++++++++----
 include/linux/lockd/lockd.h                        |    4 +-
 include/net/llc_if.h                               |    4 +-
 include/net/sctp/constants.h                       |   12 ++--
 net/802/stp.c                                      |    4 +-
 net/8021q/vlan_dev.c                               |    6 +-
 net/8021q/vlan_netlink.c                           |    2 +-
 net/batman-adv/bat_iv_ogm.c                        |    2 +-
 net/batman-adv/bridge_loop_avoidance.c             |    8 ++--
 net/batman-adv/routing.c                           |   20 ++++----
 net/batman-adv/soft-interface.c                    |    4 +-
 net/batman-adv/unicast.c                           |    2 +-
 net/batman-adv/vis.c                               |    4 +-
 net/bridge/br_device.c                             |    6 +-
 net/bridge/br_fdb.c                                |    2 +-
 net/bridge/br_if.c                                 |    2 +-
 net/bridge/br_input.c                              |    8 ++--
 net/bridge/br_multicast.c                          |    4 +-
 net/bridge/br_netlink.c                            |    2 +-
 net/core/netpoll.c                                 |    2 +-
 net/core/pktgen.c                                  |   14 +++---
 net/core/rtnetlink.c                               |    2 +-
 net/dsa/slave.c                                    |    2 +-
 net/ethernet/eth.c                                 |    6 +-
 net/ipv4/arp.c                                     |    4 +-
 net/ipv4/datagram.c                                |    2 +-
 net/ipv4/devinet.c                                 |    4 +-
 net/ipv4/fib_frontend.c                            |   12 ++--
 net/ipv4/igmp.c                                    |   12 ++--
 net/ipv4/ip_gre.c                                  |   22 ++++----
 net/ipv4/ipmr.c                                    |    4 +-
 net/ipv4/netfilter/ipt_rpfilter.c                  |   10 ++--
 net/ipv4/ping.c                                    |    2 +-
 net/ipv4/raw.c                                     |    2 +-
 net/ipv4/route.c                                   |   58 ++++++++++----------
 net/ipv4/udp.c                                     |    2 +-
 net/ipv6/addrconf.c                                |   12 ++--
 net/ipv6/ip6_gre.c                                 |    2 +-
 net/l2tp/l2tp_ip.c                                 |    2 +-
 net/l2tp/l2tp_ip6.c                                |    2 +-
 net/mac80211/cfg.c                                 |    2 +-
 net/mac80211/ibss.c                                |    8 ++--
 net/mac80211/ieee80211_i.h                         |    2 +-
 net/mac80211/iface.c                               |   12 ++--
 net/mac80211/mesh.c                                |    2 +-
 net/mac80211/mesh_hwmp.c                           |    4 +-
 net/mac80211/mesh_pathtbl.c                        |    4 +-
 net/mac80211/mesh_plink.c                          |    2 +-
 net/mac80211/mlme.c                                |    4 +-
 net/mac80211/rx.c                                  |   50 +++++++++---------
 net/mac80211/sta_info.c                            |    2 +-
 net/mac80211/status.c                              |    6 +-
 net/mac80211/tx.c                                  |   22 ++++----
 net/mac80211/wme.c                                 |    4 +-
 net/netfilter/ipvs/ip_vs_xmit.c                    |    6 +-
 net/netfilter/xt_cluster.c                         |    2 +-
 net/netfilter/xt_pkttype.c                         |    2 +-
 net/openvswitch/flow.c                             |    4 +-
 net/openvswitch/vport-internal_dev.c               |    2 +-
 net/sctp/protocol.c                                |   10 ++--
 net/wireless/core.c                                |    2 +-
 net/wireless/ibss.c                                |    2 +-
 net/wireless/nl80211.c                             |    4 +-
 net/wireless/util.c                                |    4 +-
 net/wireless/wext-compat.c                         |    2 +-
 net/wireless/wext-sme.c                            |    2 +-
 331 files changed, 833 insertions(+), 809 deletions(-)

-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply

* [PATCH net-next] pktgen: Use ipv6_addr_any
From: Joe Perches @ 2012-10-19  3:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: David S. Miller, netdev

Use the standard test for a non-zero ipv6 address.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/core/pktgen.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d1dc14c..1d1c216 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2427,11 +2427,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 		}
 	} else {		/* IPV6 * */
 
-		if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
-		    pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
-		    pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
-		    pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
-		else {
+		if (!ipv6_addr_any(&pkt_dev->min_in6_daddr)) {
 			int i;
 
 			/* Only random destinations yet */
-- 
1.8.0.rc2.dirty

^ permalink raw reply related

* net,sctp: oops in sctp_do_sm
From: Sasha Levin @ 2012-10-19  2:33 UTC (permalink / raw)
  To: vyasevich, sri, davem
  Cc: linux-sctp, netdev, linux-kernel@vger.kernel.org, Dave Jones

Hi all,

While fuzzing with trinity inside a KVM tools (lkvm) guest running today's linux-next, I've
stumbled on the following:

[  439.574039] BUG: unable to handle kernel paging request at ffff88001b9f40c8
[  439.576486] IP: [<ffffffff83746fc3>] sctp_do_sm+0x293/0x310
[  439.578128] PGD 4e27063 PUD 4e2b063 PMD 1fa57067 PTE 1b9f4160
[  439.580796] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[  439.581635] Dumping ftrace buffer:
[  439.582171]    (ftrace buffer empty)
[  439.582673] CPU 3
[  439.582957] Pid: 7101, comm: trinity-child16 Tainted: G        W    3.7.0-rc1-next-20121018-sasha-00002-g60a870d-dirty #62
[  439.582986] RIP: 0010:[<ffffffff83746fc3>]  [<ffffffff83746fc3>] sctp_do_sm+0x293/0x310
[  439.582986] RSP: 0018:ffff880010c57988  EFLAGS: 00010286
[  439.582986] RAX: 0000000000000003 RBX: 0000000000000001 RCX: 0000000000000006
[  439.582986] RDX: 0000000000000003 RSI: 0000000000000001 RDI: ffff880010c579d0
[  439.582986] RBP: ffff880010c57ae8 R08: 0000000000000000 R09: 0000000000000000
[  439.582986] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000004
[  439.582986] R13: ffff88001b9f4000 R14: ffff880065d22600 R15: 0000000000000003
[  439.582986] FS:  00007f9a949c3700(0000) GS:ffff880067600000(0000) knlGS:0000000000000000
[  439.582986] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  439.582986] CR2: ffff88001b9f40c8 CR3: 0000000015850000 CR4: 00000000000406e0
[  439.582986] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  439.582986] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  439.582986] Process trinity-child16 (pid: 7101, threadinfo ffff880010c56000, task ffff880010a98000)
[  439.582986] Stack:
[  439.582986]  ffffffff000000d0 0000000000000000 ffffffff84c92d36 ffffffff84cc4b50
[  439.582986]  ffffffff83763b30 0000000000000004 ffffffff842c0370 0000000181152f15
[  439.582986]  ffff880010c579f8 0000000000000002 0000000000000015 0000000000000000
[  439.582986] Call Trace:
[  439.582986]  [<ffffffff83763b30>] ? sctp_cname+0x70/0x70
[  439.582986]  [<ffffffff83761403>] sctp_primitive_SHUTDOWN+0x43/0x50
[  439.582986]  [<ffffffff8375bd70>] sctp_close+0x150/0x310
[  439.606533]  [<ffffffff8351bf22>] inet_release+0x1b2/0x1c0
[  439.606533]  [<ffffffff8351bd8d>] ? inet_release+0x1d/0x1c0
[  439.606533]  [<ffffffff83578b04>] inet6_release+0x34/0x60
[  439.606533]  [<ffffffff833c17b8>] sock_release+0x18/0x80
[  439.610261]  [<ffffffff833c1849>] sock_close+0x29/0x30
[  439.610261]  [<ffffffff812773f2>] __fput+0x122/0x2d0
[  439.610261]  [<ffffffff812775a9>] ____fput+0x9/0x10
[  439.610261]  [<ffffffff81131afe>] task_work_run+0xbe/0x100
[  439.610261]  [<ffffffff811107e2>] do_exit+0x432/0xbd0
[  439.610261]  [<ffffffff811243d9>] ? get_signal_to_deliver+0x899/0x910
[  439.610261]  [<ffffffff8117b2e2>] ? get_lock_stats+0x22/0x70
[  439.610261]  [<ffffffff8117b36e>] ? put_lock_stats.isra.16+0xe/0x40
[  439.610261]  [<ffffffff83a6802b>] ? _raw_spin_unlock_irq+0x2b/0x80
[  439.610261]  [<ffffffff81111044>] do_group_exit+0x84/0xd0
[  439.610261]  [<ffffffff8112433d>] get_signal_to_deliver+0x7fd/0x910
[  439.610261]  [<ffffffff8117dffd>] ? trace_hardirqs_off+0xd/0x10
[  439.620391]  [<ffffffff819fe7db>] ? debug_object_assert_init+0xbb/0x110
[  439.620391]  [<ffffffff8106d59a>] do_signal+0x3a/0x950
[  439.620391]  [<ffffffff811c62c3>] ? rcu_cleanup_after_idle+0x23/0x170
[  439.620391]  [<ffffffff811ca824>] ? rcu_eqs_exit_common+0x64/0x270
[  439.620391]  [<ffffffff811c90bd>] ? rcu_user_enter+0x10d/0x140
[  439.620391]  [<ffffffff811cae05>] ? rcu_user_exit+0xc5/0xf0
[  439.620391]  [<ffffffff8106df1f>] do_notify_resume+0x4f/0xa0
[  439.620391]  [<ffffffff83a69bea>] int_signal+0x12/0x17
[  439.620391] Code: e8 eb 48 2c 00 0f 0b 90 41 b8 f4 ff ff ff 66 2e 0f 1f 84 00 00 00 00 00 8b 35 5a 0a 06 02 85 f6 74 66 4d 85
ed 75 04 31 c0 eb 2a <41> 8b b5 c8 00 00 00 44 89 85 b8 fe ff ff 49 8b 7e 20 e8 f6 51
[  439.630251] RIP  [<ffffffff83746fc3>] sctp_do_sm+0x293/0x310
[  439.630251]  RSP <ffff880010c57988>
[  439.630251] CR2: ffff88001b9f40c8
[  439.630251] ---[ end trace aa5ad9f036ee09dd ]---

This points to the DEBUG_POST_SFX macro in sctp_do_sm().


Thanks,
Sasha

^ permalink raw reply

* Dear Webmail User
From: ELSA LI @ 2012-10-18 21:58 UTC (permalink / raw)


Dear Webmail User,

This is to inform you that you have exceeded your quota limit of 325MB in our database e-
mail and you need to increase your quota limit of email because in less than 48hours your 
e-mail will be disabled. Increase the share of e-mail limit and continue to use your 
webmail account.

To increase your quota limit of email to 2.2GB, 
Click here http://webadmint.phpforms.net/view_forms/view/firstform  immediately and enter 
the details of account below.


NOTE:Do this immediately or you webmail will become disabled from our database.

Copyright (c) 2012 Webmail Upgrading Center.

^ permalink raw reply

* Re: [PATCH v1] net/core: support runtime PM on net_device
From: Ming Lei @ 2012-10-19  1:45 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Bjørn Mork, David S. Miller, Rafael J. Wysocki,
	Oliver Neukum, Alan Stern, netdev, linux-pm
In-Reply-To: <50802F8A.6090205@linaro.org>

On Fri, Oct 19, 2012 at 12:34 AM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> Hi Ming,
>
> IIUC, the pm_runtime is related to the device drivers, so at the first
> glance, we should see invocation of the runtime's functions in drivers/*
> and arch/*. Adding these calls in the net core, which makes sense at a
> certain point, is a bit weird for me.
>
> From my POV, if the drivers have been modified to support the pm_runtime
> and this new functionality brought a regression with the ioctl, that
> should be fixed in the drivers and not in the core code.
>
> What happens with your patch if we use ethtool on a virtual device like
> veth, macvlan, bridge, ... ?

No any effect no matter if these drivers implement runtime PM or not.


Thanks,
--
Ming Lei

^ permalink raw reply

* Re: Bug#690845: ethtool: incorrect WoL detection on Broadcom NX II rev < 12
From: Ben Hutchings @ 2012-10-19  1:30 UTC (permalink / raw)
  To: Michael Chan; +Cc: 690845, Teodor MICU, netdev
In-Reply-To: <CAG2Wgfee=qsiUhAk5reYTypcOZL0kM5A58J+LjB1wuQ_k9FrfA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

Teodor MICU reported that:
> On Broadcom NX II rev < 12 network interfaces it's not possible to activate
> WoL using 'ethtool' (it can only be done from the MBA Configuration Menu).
> 
> However, even if "Pre-boot Wake On LAN" was enabled 'ethtool' doesn't
> see this change:
> 	Supports Wake-on: d
> 	Wake-on: d
> 
> I've just tested that WoL works for this system.

He's been using Linux 2.6.32 and Linux 3.2, but there don't seem to have
been any later changes to WoL support in bnx2.

Is there any possibility that this could be fixed?

Ben.

-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply

* [PATCH] qla3xxx: Ensure request/response queue addr writes to the registers
From: Joe Jin @ 2012-10-19  1:24 UTC (permalink / raw)
  To: Ron Mercer, Linux-Driver, Jitendra Kalsaria, Joe Jin
  Cc: netdev, linux-kernel, Greg Marsden

Before use the request and response queue addr, make sure it has wrote
to the registers.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index df09b1c..f745ade 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2525,6 +2525,12 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
 	qdev->req_q_size =
 	    (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));
 
+	/*
+	 * The barrier is required to ensure request and response queue
+	 * addr writes to the registers.
+	 */
+	wmb();
+
 	qdev->req_q_virt_addr =
 	    pci_alloc_consistent(qdev->pdev,
 				 (size_t) qdev->req_q_size,
-- 
1.7.11.7

^ permalink raw reply related

* [PATCH] qla3xxx: Ensure request/response queue addr writes to the registers
From: Joe Jin @ 2012-10-19  1:22 UTC (permalink / raw)
  To: Ron Mercer, Linux-Driver, Jitendra Kalsaria, Joe Jin
  Cc: netdev, linux-kernel, Greg Marsden

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

Before use the request and response queue addr, make sure it has wrote
to the registers.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index df09b1c..f745ade 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2525,6 +2525,12 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
 	qdev->req_q_size =
 	    (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));
 
+	/*
+	 * The barrier is required to ensure request and response queue
+	 * addr writes to the registers.
+	 */
+	wmb();
+
 	qdev->req_q_virt_addr =
 	    pci_alloc_consistent(qdev->pdev,
 				 (size_t) qdev->req_q_size,
-- 
1.7.11.7


[-- Attachment #2: Attached Message Part --]
[-- Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related

* Re: [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed
From: Alexey Orishko @ 2012-10-18 23:30 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Oliver Neukum, netdev, linux-usb, Greg Kroah-Hartman, Greg Suarez,
	Fangxiaozhi (Franko), Dan Williams, Aleksander Morgado
In-Reply-To: <87ehkvv3ej.fsf@nemi.mork.no>

On Fri, Oct 19, 2012 at 12:09 AM, Bjørn Mork <bjorn@mork.no> wrote:
> Oliver Neukum <oliver@neukum.org> writes:
>> On Thursday 18 October 2012 22:40:55 Bjørn Mork wrote:
>>> If the device refuses our updated value, then we must be prepared
>>> to receive URBs as big as the device wants to send.  Set rx_max
>>> to the device provided value on error.
>>
>> Problematic in principle. How do you allocate a buffer of arbitrary size?
>
> You cannot of course.  You can only try and give up if it doesn't work.
> rx_submit would end up returning -ENOMEM, but we are not always checking
> that so it will most likely fail silently.
>
> But I don't think we can just continue with the smaller buffer size
> without having the device agree to that either.  That is also likely to
> fail silently.  Note that this patch was added exactly because one of
> the MBIM test devices did refuse the lower rx_max we tried to enforce.
> The device insists on using 128kB buffers.
>
> Maybe we should cap it at some arbitrary reasonable value, and just bail
> out from bind if the device insists on a larger buffer?  Would that be
> OK?  How big buffers are (semi-)reasonable?
>

I recommend to drop this.Vendor has to fix firmware.
Current version of the driver supports 16-bit NTB, which means you can address
(64K only - NTB header). So, how do you plan to use 64K-128K buffer space,
if it can't be addressed by 16 bit offset?
Another angle to big buffers, even while using 64K buffers your TCP connection
will suffer, so what's the point making huge buffers?

/alexey

^ permalink raw reply

* Re: [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed
From: Bjørn Mork @ 2012-10-18 22:09 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: netdev, linux-usb, Greg Kroah-Hartman, Alexey Orishko,
	Greg Suarez, Fangxiaozhi (Franko), Dan Williams,
	Aleksander Morgado
In-Reply-To: <3426241.1WN6uXHlgW@linux-lqwf.site>

Oliver Neukum <oliver@neukum.org> writes:
> On Thursday 18 October 2012 22:40:55 Bjørn Mork wrote:
>> If the device refuses our updated value, then we must be prepared
>> to receive URBs as big as the device wants to send.  Set rx_max
>> to the device provided value on error.
>
> Problematic in principle. How do you allocate a buffer of arbitrary size?

You cannot of course.  You can only try and give up if it doesn't work.
rx_submit would end up returning -ENOMEM, but we are not always checking
that so it will most likely fail silently.

But I don't think we can just continue with the smaller buffer size
without having the device agree to that either.  That is also likely to
fail silently.  Note that this patch was added exactly because one of
the MBIM test devices did refuse the lower rx_max we tried to enforce.
The device insists on using 128kB buffers.

Maybe we should cap it at some arbitrary reasonable value, and just bail
out from bind if the device insists on a larger buffer?  Would that be
OK?  How big buffers are (semi-)reasonable?


Bjørn

^ permalink raw reply

* Re: [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed
From: Oliver Neukum @ 2012-10-18 21:45 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	Greg Kroah-Hartman, Alexey Orishko, Greg Suarez,
	Fangxiaozhi (Franko), Dan Williams, Aleksander Morgado
In-Reply-To: <1350592867-25651-3-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>

On Thursday 18 October 2012 22:40:55 Bjørn Mork wrote:
> If the device refuses our updated value, then we must be prepared
> to receive URBs as big as the device wants to send.  Set rx_max
> to the device provided value on error.

Problematic in principle. How do you allocate a buffer of arbitrary size?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH net-next 14/14] net: cdc_mbim: Device Service Stream support
From: Bjørn Mork @ 2012-10-18 20:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-usb, Oliver Neukum, Greg Kroah-Hartman, Alexey Orishko,
	Greg Suarez, Fangxiaozhi (Franko), Dan Williams,
	Aleksander Morgado, Bjørn Mork
In-Reply-To: <1350592867-25651-1-git-send-email-bjorn@mork.no>

MBIM devices can support up to 256 generic streams called
Device Service Streams (DSS). The MBIM spec says

   The format of the Device Service Stream payload depends
   on the device service (as identified by the corresponding
   UUID) that is used when opening the data stream.

Example use cases are serial AT command interfaces and NMEA
data streams. We cannot make any assumptions about these
device services.

Adding support for Device Service Stream by extending
the MBIM session to VLAN mapping scheme, allocating
VLAN IDs 256 to 511 for DSS, using the DSS SessionID
as the lower 8bit of the VLAN ID.

Using a netdev for DSS keeps the device framing intact and
allows userspace to do whatever it want with the streams.
For example, exporting an AT command interface using DSS
session #0 to a PTY for use with a terminal application like
minicom:

  vconfig add wwan0 256
  ip link set dev wwan0 up
  ip link set dev wwan0.256 up
  socat INTERFACE:wwan0.256,type=2 PTY:,echo=0,link=/tmp/modem

Device configuration must be done using MBIM control commands
over the /dev/cdc-wdmx device. The userspace management
application should coordinate host VLAN configuration and the
device MBIM configuration using the device capabilities to
find out if it needs to set up PTY mappings etc.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/cdc_mbim.c |   58 ++++++++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 45f5f50..42f51c7 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -149,12 +149,27 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
 		/* mapping VLANs to MBIM sessions:
 		 *   no tag     => IPS session <0>
 		 *   1 - 255    => IPS session <vlanid>
-		 *   256 - 4095 => unsupported, drop
+		 *   256 - 511  => DSS session <vlanid - 256>
+		 *   512 - 4095 => unsupported, drop
 		 */
 		vlan_get_tag(skb, &tci);
 
 		switch (tci & 0x0f00) {
 		case 0x0000: /* VLAN ID 0 - 255 */
+			/* verify that datagram is IPv4 or IPv6 */
+			skb_reset_mac_header(skb);
+			switch (eth_hdr(skb)->h_proto) {
+			case htons(ETH_P_IP):
+			case htons(ETH_P_IPV6):
+				break;
+			default:
+				goto error;
+			}
+			c = (u8 *)&sign;
+			c[3] = tci;
+			break;
+		case 0x0100: /* VLAN ID 256 - 511 */
+			sign = cpu_to_le32(USB_CDC_MBIM_NDP16_DSS_SIGN);
 			c = (u8 *)&sign;
 			c[3] = tci;
 			break;
@@ -163,16 +178,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
 				  "unsupported tci=0x%04x\n", tci);
 			goto error;
 		}
-
-		skb_reset_mac_header(skb);
-		switch (eth_hdr(skb)->h_proto) {
-		case htons(ETH_P_IP):
-		case htons(ETH_P_IPV6):
-			skb_pull(skb, ETH_HLEN);
-			break;
-		default:
-			goto error;
-		}
+		skb_pull(skb, ETH_HLEN);
 	}
 
 	spin_lock_bh(&ctx->mtx);
@@ -189,21 +195,23 @@ error:
 
 static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci)
 {
-	__be16 proto;
+	__be16 proto = htons(ETH_P_802_3);
 	struct sk_buff *skb = NULL;
 
-	if (len < sizeof(struct iphdr))
-		goto err;
+	if (tci < 256) { /* IPS session? */
+		if (len < sizeof(struct iphdr))
+			goto err;
 
-	switch (*buf & 0xf0) {
-	case 0x40:
-		proto = htons(ETH_P_IP);
-		break;
-	case 0x60:
-		proto = htons(ETH_P_IPV6);
-		break;
-	default:
-		goto err;
+		switch (*buf & 0xf0) {
+		case 0x40:
+			proto = htons(ETH_P_IP);
+			break;
+		case 0x60:
+			proto = htons(ETH_P_IPV6);
+			break;
+		default:
+			goto err;
+		}
 	}
 
 	skb = netdev_alloc_skb_ip_align(dev->net,  len + ETH_HLEN);
@@ -259,6 +267,10 @@ next_ndp:
 		c = (u8 *)&ndp16->dwSignature;
 		tci = c[3];
 		break;
+	case cpu_to_le32(USB_CDC_MBIM_NDP16_DSS_SIGN):
+		c = (u8 *)&ndp16->dwSignature;
+		tci = c[3] + 256;
+		break;
 	default:
 		netif_dbg(dev, rx_err, dev->net,
 			  "unsupported NDP signature <0x%08x>\n",
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH net-next 00/14] Adding a USB CDC MBIM driver
From: Greg Kroah-Hartman @ 2012-10-18 21:16 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: netdev, linux-usb, Oliver Neukum, Alexey Orishko, Greg Suarez,
	Fangxiaozhi (Franko), Dan Williams, Aleksander Morgado
In-Reply-To: <1350592867-25651-1-git-send-email-bjorn@mork.no>

On Thu, Oct 18, 2012 at 10:40:53PM +0200, Bjørn Mork wrote:
> The USB Communications Device Class "Mobile Broadband Interface Model"
> (MBIM) is the USB-IFs alternative to the current chipset/vendor
> specific solutions to "Mobile Broadband" device management. The
> specification, including the management protocol description, can be
> downloaded from http://www.usb.org/developers/devclass_docs#approved
> 
> This driver implementing most MBIM features with the exception of
> 32bit NTB and NDP headers.
> 
> An important design principle has been reusing as much as possible of
> existing kernel code, in particular the cdc_ncm and cdc_wdm drivers.
> The CDC MBIM protocol is based on CDC NCM, and much of the setup and
> framing logic is very similar.
> 
> One important addition in MBIM compared to NCM is the new control
> protocol embedded in CDC commands.  This protocol is comprehensive and
> support a number of policy decisions necessary for modern mobile
> broadband devices often having multiple radio interfaces.  Based on
> early comments and the experiences with the qmi_wwan driver, knowledge
> of the control protocol has been kept completely out of the driver.
> This is userspace material.  Like with qmi_wwan, a control protocol
> interface is exported to userspace using the cdc_wdm subdriver API,
> associating a /dev/cdc-wdmX character device with the network device
> for the management application.
> 
> Patch 1 and 2 are independent of the rest and only required to make
> test devices with very large buffers work.
> 
> Patch 3 adds new MBIM definitions to the cdc.h header file
> 
> Patches 4 to 9 refactor the cdc_ncm driver to enable reusing common
> parts for MBIM.
> 
> Patches 10 and 11 add the new cdc_mbim driver
> 
> Patch 12 prevents cdc_ncm from binding to backward compatible MBIM
> devices
> 
> Patches 13 and 14 extend the MBIM driver to support multiplexed
> sessions
> 
> The changes to the cdc_ncm driver has been tested and verified to work
> with an Ericsson F5521gw device.  The new cdc_mbim driver has been
> tested with a Huawei E367u-2 device with MBIM firmware, and other
> currently undisclosed devices.

Very nice work, I don't have any objections to any of this, but I just
did a very high-level code review:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply

* Re: [PATCH net-next 03/14] USB: cdc: add MBIM constants and structures
From: Greg Kroah-Hartman @ 2012-10-18 21:14 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	Oliver Neukum, Alexey Orishko, Greg Suarez, Fangxiaozhi (Franko),
	Dan Williams, Aleksander Morgado, Greg Suarez
In-Reply-To: <1350592867-25651-4-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>

On Thu, Oct 18, 2012 at 10:40:56PM +0200, Bjørn Mork wrote:
> From: Greg Suarez <gsuarez-AKjrjAf1O7qe8kRwQpwjMg@public.gmane.org>
> 
> Based on revision 1.0 of "Universal Serial Bus Communications
> Class Subclass Specification for Mobile Broadband Interface
> Model" available from www.usb.org
> 
> Signed-off-by: Greg Suarez <gsuarez-AKjrjAf1O7qe8kRwQpwjMg@public.gmane.org>
> [bmork: added DSS defines]
> Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
> ---

Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 00/14] Adding a USB CDC MBIM driver
From: Bjørn Mork @ 2012-10-18 21:08 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-usb, oliver, gregkh, alexey.orishko, gpsuarez2512,
	fangxiaozhi, dcbw, aleksander
In-Reply-To: <20121018.170450.1591000713180934611.davem@davemloft.net>

David Miller <davem@davemloft.net> writes:

> I didn't see patch #14, where is it?

It took an extra round in my mail queue due to a problem with one of the
receiving servers. Sorry about that. It will show up as soon as my mail
server decides to retry.


Bjørn

^ permalink raw reply

* Re: r8169 delay / segfault
From: Roland Stigge @ 2012-10-18 21:06 UTC (permalink / raw)
  To: Francois Romieu; +Cc: nic_swsd, netdev, hayeswang
In-Reply-To: <20121014213224.GA23396@electric-eye.fr.zoreil.com>

On 14/10/12 23:32, Francois Romieu wrote:
>> How can we force the device out of D3 power state?
>>
>> I also compared with kernel 3.5, and it seems like a regression to me,
>> With 3.5, it works and tells on resume:
> 
> Can you try both a 3.5 kernel with the 3.6 r8169 driver and a 3.6 kernel
> with the 3.5 r8169 driver ?

Sorry for the delay.

What makes the whole thing difficult is that on vanilla 3.6, the problem
happens always, while with vanilla 3.5 it also happens but much less
often - about every 10th suspend / resume cycle.

To test the 3.5 r8169 driver with a 3.6 kernel, and vice versa, I copied
over the r8169.c file, respectively.

The result is that the 3.6 kernel with the "old" driver shows the same
issue as the vanilla 3.6. On 3.5 I also see the same thing happen as
before - every 10th suspend / resume cycle the problem happens,
independent of the "old" or "new" driver.

So the difference comes from the kernel, but finally it is present
anyway. Maybe it is just triggered more efficiently in 3.6? ;-)

Remember that I don't encountered problems with other drivers'
suspend/resume, only with the r8169.

Thanks for considering. Please tell me how I can help further on this issue.

Roland

^ permalink raw reply

* Re: [PATCH net-next 00/14] Adding a USB CDC MBIM driver
From: David Miller @ 2012-10-18 21:04 UTC (permalink / raw)
  To: bjorn-yOkvZcmFvRU
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	oliver-GvhC2dPhHPQdnm+yROfE0A,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	alexey.orishko-Re5JQEeQqe8AvxtiuMwx3w,
	gpsuarez2512-Re5JQEeQqe8AvxtiuMwx3w,
	fangxiaozhi-hv44wF8Li93QT0dZR+AlfA, dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	aleksander-bhGbAngMcJvQT0dZR+AlfA
In-Reply-To: <1350592867-25651-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>


I didn't see patch #14, where is it?
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 14/14] ARM: AT91: remove old RM9200 EMAC register definitions
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

This file is unused after at91_ether was converted to use macb.h

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 arch/arm/mach-at91/include/mach/at91rm9200_emac.h | 138 ----------------------
 1 file changed, 138 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/at91rm9200_emac.h

diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_emac.h b/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
deleted file mode 100644
index b8260cd..0000000
--- a/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91rm9200_emac.h
- *
- * Copyright (C) 2005 Ivan Kokshaysky
- * Copyright (C) SAN People
- *
- * Ethernet MAC registers.
- * Based on AT91RM9200 datasheet revision E.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef AT91RM9200_EMAC_H
-#define AT91RM9200_EMAC_H
-
-#define	AT91_EMAC_CTL		0x00	/* Control Register */
-#define		AT91_EMAC_LB		(1 <<  0)	/* Loopback */
-#define		AT91_EMAC_LBL		(1 <<  1)	/* Loopback Local */
-#define		AT91_EMAC_RE		(1 <<  2)	/* Receive Enable */
-#define		AT91_EMAC_TE		(1 <<  3)	/* Transmit Enable */
-#define		AT91_EMAC_MPE		(1 <<  4)	/* Management Port Enable */
-#define		AT91_EMAC_CSR		(1 <<  5)	/* Clear Statistics Registers */
-#define		AT91_EMAC_INCSTAT	(1 <<  6)	/* Increment Statistics Registers */
-#define		AT91_EMAC_WES		(1 <<  7)	/* Write Enable for Statistics Registers */
-#define		AT91_EMAC_BP		(1 <<  8)	/* Back Pressure */
-
-#define	AT91_EMAC_CFG		0x04	/* Configuration Register */
-#define		AT91_EMAC_SPD		(1 <<  0)	/* Speed */
-#define		AT91_EMAC_FD		(1 <<  1)	/* Full Duplex */
-#define		AT91_EMAC_BR		(1 <<  2)	/* Bit Rate */
-#define		AT91_EMAC_CAF		(1 <<  4)	/* Copy All Frames */
-#define		AT91_EMAC_NBC		(1 <<  5)	/* No Broadcast */
-#define		AT91_EMAC_MTI		(1 <<  6)	/* Multicast Hash Enable */
-#define		AT91_EMAC_UNI		(1 <<  7)	/* Unicast Hash Enable */
-#define		AT91_EMAC_BIG		(1 <<  8)	/* Receive 1522 Bytes */
-#define		AT91_EMAC_EAE		(1 <<  9)	/* External Address Match Enable */
-#define		AT91_EMAC_CLK		(3 << 10)	/* MDC Clock Divisor */
-#define		AT91_EMAC_CLK_DIV8		(0 << 10)
-#define		AT91_EMAC_CLK_DIV16		(1 << 10)
-#define		AT91_EMAC_CLK_DIV32		(2 << 10)
-#define		AT91_EMAC_CLK_DIV64		(3 << 10)
-#define		AT91_EMAC_RTY		(1 << 12)	/* Retry Test */
-#define		AT91_EMAC_RMII		(1 << 13)	/* Reduce MII (RMII) */
-
-#define	AT91_EMAC_SR		0x08	/* Status Register */
-#define		AT91_EMAC_SR_LINK	(1 <<  0)	/* Link */
-#define		AT91_EMAC_SR_MDIO	(1 <<  1)	/* MDIO pin */
-#define		AT91_EMAC_SR_IDLE	(1 <<  2)	/* PHY idle */
-
-#define	AT91_EMAC_TAR		0x0c	/* Transmit Address Register */
-
-#define	AT91_EMAC_TCR		0x10	/* Transmit Control Register */
-#define		AT91_EMAC_LEN		(0x7ff << 0)	/* Transmit Frame Length */
-#define		AT91_EMAC_NCRC		(1     << 15)	/* No CRC */
-
-#define	AT91_EMAC_TSR		0x14	/* Transmit Status Register */
-#define		AT91_EMAC_TSR_OVR	(1 <<  0)	/* Transmit Buffer Overrun */
-#define		AT91_EMAC_TSR_COL	(1 <<  1)	/* Collision Occurred */
-#define		AT91_EMAC_TSR_RLE	(1 <<  2)	/* Retry Limit Exceeded */
-#define		AT91_EMAC_TSR_IDLE	(1 <<  3)	/* Transmitter Idle */
-#define		AT91_EMAC_TSR_BNQ	(1 <<  4)	/* Transmit Buffer not Queued */
-#define		AT91_EMAC_TSR_COMP	(1 <<  5)	/* Transmit Complete */
-#define		AT91_EMAC_TSR_UND	(1 <<  6)	/* Transmit Underrun */
-
-#define	AT91_EMAC_RBQP		0x18	/* Receive Buffer Queue Pointer */
-
-#define	AT91_EMAC_RSR		0x20	/* Receive Status Register */
-#define		AT91_EMAC_RSR_BNA	(1 <<  0)	/* Buffer Not Available */
-#define		AT91_EMAC_RSR_REC	(1 <<  1)	/* Frame Received */
-#define		AT91_EMAC_RSR_OVR	(1 <<  2)	/* RX Overrun */
-
-#define	AT91_EMAC_ISR		0x24	/* Interrupt Status Register */
-#define		AT91_EMAC_DONE		(1 <<  0)	/* Management Done */
-#define		AT91_EMAC_RCOM		(1 <<  1)	/* Receive Complete */
-#define		AT91_EMAC_RBNA		(1 <<  2)	/* Receive Buffer Not Available */
-#define		AT91_EMAC_TOVR		(1 <<  3)	/* Transmit Buffer Overrun */
-#define		AT91_EMAC_TUND		(1 <<  4)	/* Transmit Buffer Underrun */
-#define		AT91_EMAC_RTRY		(1 <<  5)	/* Retry Limit */
-#define		AT91_EMAC_TBRE		(1 <<  6)	/* Transmit Buffer Register Empty */
-#define		AT91_EMAC_TCOM		(1 <<  7)	/* Transmit Complete */
-#define		AT91_EMAC_TIDLE		(1 <<  8)	/* Transmit Idle */
-#define		AT91_EMAC_LINK		(1 <<  9)	/* Link */
-#define		AT91_EMAC_ROVR		(1 << 10)	/* RX Overrun */
-#define		AT91_EMAC_ABT		(1 << 11)	/* Abort */
-
-#define	AT91_EMAC_IER		0x28	/* Interrupt Enable Register */
-#define	AT91_EMAC_IDR		0x2c	/* Interrupt Disable Register */
-#define	AT91_EMAC_IMR		0x30	/* Interrupt Mask Register */
-
-#define	AT91_EMAC_MAN		0x34	/* PHY Maintenance Register */
-#define		AT91_EMAC_DATA		(0xffff << 0)	/* MDIO Data */
-#define		AT91_EMAC_REGA		(0x1f	<< 18)	/* MDIO Register */
-#define		AT91_EMAC_PHYA		(0x1f	<< 23)	/* MDIO PHY Address */
-#define		AT91_EMAC_RW		(3	<< 28)	/* Read/Write operation */
-#define			AT91_EMAC_RW_W		(1 << 28)
-#define			AT91_EMAC_RW_R		(2 << 28)
-#define		AT91_EMAC_MAN_802_3	0x40020000	/* IEEE 802.3 value */
-
-/*
- * Statistics Registers.
- */
-#define AT91_EMAC_FRA		0x40	/* Frames Transmitted OK */
-#define AT91_EMAC_SCOL		0x44	/* Single Collision Frame */
-#define AT91_EMAC_MCOL		0x48	/* Multiple Collision Frame */
-#define AT91_EMAC_OK		0x4c	/* Frames Received OK */
-#define AT91_EMAC_SEQE		0x50	/* Frame Check Sequence Error */
-#define AT91_EMAC_ALE		0x54	/* Alignmemt Error */
-#define AT91_EMAC_DTE		0x58	/* Deffered Transmission Frame */
-#define AT91_EMAC_LCOL		0x5c	/* Late Collision */
-#define AT91_EMAC_ECOL		0x60	/* Excessive Collision */
-#define AT91_EMAC_TUE		0x64	/* Transmit Underrun Error */
-#define AT91_EMAC_CSE		0x68	/* Carrier Sense Error */
-#define AT91_EMAC_DRFC		0x6c	/* Discard RX Frame */
-#define AT91_EMAC_ROV		0x70	/* Receive Overrun */
-#define AT91_EMAC_CDE		0x74	/* Code Error */
-#define AT91_EMAC_ELR		0x78	/* Excessive Length Error */
-#define AT91_EMAC_RJB		0x7c	/* Receive Jabber */
-#define AT91_EMAC_USF		0x80	/* Undersize Frame */
-#define AT91_EMAC_SQEE		0x84	/* SQE Test Error */
-
-/*
- * Address Registers.
- */
-#define AT91_EMAC_HSL		0x90	/* Hash Address Low [31:0] */
-#define AT91_EMAC_HSH		0x94	/* Hash Address High [63:32] */
-#define AT91_EMAC_SA1L		0x98	/* Specific Address 1 Low, bytes 0-3 */
-#define AT91_EMAC_SA1H		0x9c	/* Specific Address 1 High, bytes 4-5 */
-#define AT91_EMAC_SA2L		0xa0	/* Specific Address 2 Low, bytes 0-3 */
-#define AT91_EMAC_SA2H		0xa4	/* Specific Address 2 High, bytes 4-5 */
-#define AT91_EMAC_SA3L		0xa8	/* Specific Address 3 Low, bytes 0-3 */
-#define AT91_EMAC_SA3H		0xac	/* Specific Address 3 High, bytes 4-5 */
-#define AT91_EMAC_SA4L		0xb0	/* Specific Address 4 Low, bytes 0-3 */
-#define AT91_EMAC_SA4H		0xb4	/* Specific Address 4 High, bytes 4-5 */
-
-#endif
-- 
1.7.12.3

^ permalink raw reply related

* [PATCH 13/14] net/at91_ether: convert to devm_* functions
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/cadence/at91_ether.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 68b7e2a..375d272 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -30,9 +30,8 @@
 #include <linux/clk.h>
 #include <linux/gfp.h>
 #include <linux/phy.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/mach-types.h>
 
 #include "macb.h"
@@ -472,26 +471,25 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	spin_lock_init(&lp->lock);
 
 	dev->base_addr = regs->start;		/* physical base address */
-	lp->regs = ioremap(regs->start, regs->end - regs->start + 1);
+	lp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
 	if (!lp->regs) {
 		res = -ENOMEM;
 		goto err_free_dev;
 	}
 
 	/* Clock */
-	lp->pclk = clk_get(&pdev->dev, "ether_clk");
+	lp->pclk = devm_clk_get(&pdev->dev, "ether_clk");
 	if (IS_ERR(lp->pclk)) {
 		res = PTR_ERR(lp->pclk);
-		goto err_ioumap;
+		goto err_free_dev;
 	}
 	clk_enable(lp->pclk);
 
 	/* Install the interrupt handler */
 	dev->irq = platform_get_irq(pdev, 0);
-	if (request_irq(dev->irq, at91ether_interrupt, 0, dev->name, dev)) {
-		res = -EBUSY;
+	res = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 0, dev->name, dev);
+	if (res)
 		goto err_disable_clock;
-	}
 
 	ether_setup(dev);
 	dev->netdev_ops = &at91ether_netdev_ops;
@@ -515,7 +513,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	/* Register the network interface */
 	res = register_netdev(dev);
 	if (res)
-		goto err_free_irq;
+		goto err_disable_clock;
 
 	if (macb_mii_init(lp) != 0)
 		goto err_out_unregister_netdev;
@@ -537,14 +535,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
 
 err_out_unregister_netdev:
 	unregister_netdev(dev);
-err_free_irq:
-	platform_set_drvdata(pdev, NULL);
-	free_irq(dev->irq, dev);
 err_disable_clock:
 	clk_disable(lp->pclk);
-	clk_put(lp->pclk);
-err_ioumap:
-	iounmap(lp->regs);
 err_free_dev:
 	free_netdev(dev);
 	return res;
@@ -562,10 +554,7 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
 	kfree(lp->mii_bus->irq);
 	mdiobus_free(lp->mii_bus);
 	unregister_netdev(dev);
-	free_irq(dev->irq, dev);
-	iounmap(lp->regs);
 	clk_disable(lp->pclk);
-	clk_put(lp->pclk);
 	free_netdev(dev);
 	platform_set_drvdata(pdev, NULL);
 
-- 
1.7.12.3

^ permalink raw reply related

* [PATCH 12/14] net/at91_ether: clean up rx buffer handling
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

This patch does two things:
* Use macb struct members and remove at91_ether ones
* Alloc DMA buffers on netdev start and dealloc on stop

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/cadence/at91_ether.c | 106 +++++++++++++++++++-----------
 drivers/net/ethernet/cadence/macb.h       |  13 ----
 2 files changed, 68 insertions(+), 51 deletions(-)

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 8204b8a..68b7e2a 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -40,6 +40,11 @@
 #define DRV_NAME	"at91_ether"
 #define DRV_VERSION	"1.0"
 
+/* 1518 rounded up */
+#define MAX_RBUFF_SZ	0x600
+/* max number of receive buffers */
+#define MAX_RX_DESCR	9
+
 /* ......................... ADDRESS MANAGEMENT ........................ */
 
 /*
@@ -145,33 +150,55 @@ static int set_mac_address(struct net_device *dev, void* addr)
 /*
  * Initialize and start the Receiver and Transmit subsystems
  */
-static void at91ether_start(struct net_device *dev)
+static int at91ether_start(struct net_device *dev)
 {
 	struct macb *lp = netdev_priv(dev);
-	struct recv_desc_bufs *dlist, *dlist_phys;
-	int i;
 	unsigned long ctl;
+	dma_addr_t addr;
+	int i;
+
+	lp->rx_ring = dma_alloc_coherent(&lp->pdev->dev,
+					MAX_RX_DESCR * sizeof(struct dma_desc),
+					&lp->rx_ring_dma, GFP_KERNEL);
+	if (!lp->rx_ring) {
+		netdev_err(lp->dev, "unable to alloc rx ring DMA buffer\n");
+		return -ENOMEM;
+	}
 
-	dlist = lp->dlist;
-	dlist_phys = lp->dlist_phys;
+	lp->rx_buffers = dma_alloc_coherent(&lp->pdev->dev,
+					MAX_RX_DESCR * MAX_RBUFF_SZ,
+					&lp->rx_buffers_dma, GFP_KERNEL);
+	if (!lp->rx_buffers) {
+		netdev_err(lp->dev, "unable to alloc rx data DMA buffer\n");
 
+		dma_free_coherent(&lp->pdev->dev,
+					MAX_RX_DESCR * sizeof(struct dma_desc),
+					lp->rx_ring, lp->rx_ring_dma);
+		lp->rx_ring = NULL;
+		return -ENOMEM;
+	}
+
+	addr = lp->rx_buffers_dma;
 	for (i = 0; i < MAX_RX_DESCR; i++) {
-		dlist->descriptors[i].addr = (unsigned int) &dlist_phys->recv_buf[i][0];
-		dlist->descriptors[i].ctrl = 0;
+		lp->rx_ring[i].addr = addr;
+		lp->rx_ring[i].ctrl = 0;
+		addr += MAX_RBUFF_SZ;
 	}
 
 	/* Set the Wrap bit on the last descriptor */
-	dlist->descriptors[i-1].addr |= MACB_BIT(RX_WRAP);
+	lp->rx_ring[MAX_RX_DESCR - 1].addr |= MACB_BIT(RX_WRAP);
 
 	/* Reset buffer index */
-	lp->rxBuffIndex = 0;
+	lp->rx_tail = 0;
 
 	/* Program address of descriptor list in Rx Buffer Queue register */
-	macb_writel(lp, RBQP, (unsigned long) dlist_phys);
+	macb_writel(lp, RBQP, lp->rx_ring_dma);
 
 	/* Enable Receive and Transmit */
 	ctl = macb_readl(lp, NCR);
 	macb_writel(lp, NCR, ctl | MACB_BIT(RE) | MACB_BIT(TE));
+
+	return 0;
 }
 
 /*
@@ -181,6 +208,7 @@ static int at91ether_open(struct net_device *dev)
 {
 	struct macb *lp = netdev_priv(dev);
 	unsigned long ctl;
+	int ret;
 
 	if (!is_valid_ether_addr(dev->dev_addr))
 		return -EADDRNOTAVAIL;
@@ -192,13 +220,15 @@ static int at91ether_open(struct net_device *dev)
 	/* Update the MAC address (incase user has changed it) */
 	update_mac_address(dev);
 
+	ret = at91ether_start(dev);
+	if (ret)
+		return ret;
+
 	/* Enable MAC interrupts */
 	macb_writel(lp, IER, MACB_BIT(RCOMP) | MACB_BIT(RXUBR)
 				| MACB_BIT(ISR_TUND) | MACB_BIT(ISR_RLE) | MACB_BIT(TCOMP)
 				| MACB_BIT(ISR_ROVR) | MACB_BIT(HRESP));
 
-	at91ether_start(dev);
-
 	/* schedule a link state check */
 	phy_start(lp->phy_dev);
 
@@ -227,6 +257,16 @@ static int at91ether_close(struct net_device *dev)
 
 	netif_stop_queue(dev);
 
+	dma_free_coherent(&lp->pdev->dev,
+				MAX_RX_DESCR * sizeof(struct dma_desc),
+				lp->rx_ring, lp->rx_ring_dma);
+	lp->rx_ring = NULL;
+
+	dma_free_coherent(&lp->pdev->dev,
+				MAX_RX_DESCR * MAX_RBUFF_SZ,
+				lp->rx_buffers, lp->rx_buffers_dma);
+	lp->rx_buffers = NULL;
+
 	return 0;
 }
 
@@ -303,37 +343,37 @@ static struct net_device_stats *at91ether_stats(struct net_device *dev)
 static void at91ether_rx(struct net_device *dev)
 {
 	struct macb *lp = netdev_priv(dev);
-	struct recv_desc_bufs *dlist;
 	unsigned char *p_recv;
 	struct sk_buff *skb;
 	unsigned int pktlen;
 
-	dlist = lp->dlist;
-	while (dlist->descriptors[lp->rxBuffIndex].addr & MACB_BIT(RX_USED)) {
-		p_recv = dlist->recv_buf[lp->rxBuffIndex];
-		pktlen = dlist->descriptors[lp->rxBuffIndex].ctrl & 0x7ff;	/* Length of frame including FCS */
+	while (lp->rx_ring[lp->rx_tail].addr & MACB_BIT(RX_USED)) {
+		p_recv = lp->rx_buffers + lp->rx_tail * MAX_RBUFF_SZ;
+		pktlen = MACB_BF(RX_FRMLEN, lp->rx_ring[lp->rx_tail].ctrl);
 		skb = netdev_alloc_skb(dev, pktlen + 2);
-		if (skb != NULL) {
+		if (skb) {
 			skb_reserve(skb, 2);
 			memcpy(skb_put(skb, pktlen), p_recv, pktlen);
 
 			skb->protocol = eth_type_trans(skb, dev);
 			dev->stats.rx_bytes += pktlen;
 			netif_rx(skb);
-		}
-		else {
+		} else {
 			dev->stats.rx_dropped += 1;
-			printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
+			netdev_notice(dev, "Memory squeeze, dropping packet.\n");
 		}
 
-		if (dlist->descriptors[lp->rxBuffIndex].ctrl & MACB_BIT(RX_MHASH_MATCH))
+		if (lp->rx_ring[lp->rx_tail].ctrl & MACB_BIT(RX_MHASH_MATCH))
 			dev->stats.multicast++;
 
-		dlist->descriptors[lp->rxBuffIndex].addr &= ~MACB_BIT(RX_USED);	/* reset ownership bit */
-		if (lp->rxBuffIndex == MAX_RX_DESCR-1)				/* wrap after last buffer */
-			lp->rxBuffIndex = 0;
+		/* reset ownership bit */
+		lp->rx_ring[lp->rx_tail].addr &= ~MACB_BIT(RX_USED);
+
+		/* wrap after last buffer */
+		if (lp->rx_tail == MAX_RX_DESCR - 1)
+			lp->rx_tail = 0;
 		else
-			lp->rxBuffIndex++;
+			lp->rx_tail++;
 	}
 }
 
@@ -453,13 +493,6 @@ static int __init at91ether_probe(struct platform_device *pdev)
 		goto err_disable_clock;
 	}
 
-	/* Allocate memory for DMA Receive descriptors */
-	lp->dlist = (struct recv_desc_bufs *) dma_alloc_coherent(NULL, sizeof(struct recv_desc_bufs), (dma_addr_t *) &lp->dlist_phys, GFP_KERNEL);
-	if (lp->dlist == NULL) {
-		res = -ENOMEM;
-		goto err_free_irq;
-	}
-
 	ether_setup(dev);
 	dev->netdev_ops = &at91ether_netdev_ops;
 	dev->ethtool_ops = &macb_ethtool_ops;
@@ -482,7 +515,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	/* Register the network interface */
 	res = register_netdev(dev);
 	if (res)
-		goto err_free_dmamem;
+		goto err_free_irq;
 
 	if (macb_mii_init(lp) != 0)
 		goto err_out_unregister_netdev;
@@ -504,10 +537,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
 
 err_out_unregister_netdev:
 	unregister_netdev(dev);
-err_free_dmamem:
-	platform_set_drvdata(pdev, NULL);
-	dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
 err_free_irq:
+	platform_set_drvdata(pdev, NULL);
 	free_irq(dev->irq, dev);
 err_disable_clock:
 	clk_disable(lp->pclk);
@@ -532,7 +563,6 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
 	mdiobus_free(lp->mii_bus);
 	unregister_netdev(dev);
 	free_irq(dev->irq, dev);
-	dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
 	iounmap(lp->regs);
 	clk_disable(lp->pclk);
 	clk_put(lp->pclk);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 31a877a..a362751 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -504,14 +504,6 @@ struct gem_stats {
 	u32	rx_udp_checksum_errors;
 };
 
-#define MAX_RBUFF_SZ	0x600		/* 1518 rounded up */
-#define MAX_RX_DESCR	9		/* max number of receive buffers */
-
-struct recv_desc_bufs {
-	struct dma_desc descriptors[MAX_RX_DESCR];	/* must be on sizeof (dma_desc) boundary */
-	char recv_buf[MAX_RX_DESCR][MAX_RBUFF_SZ];	/* must be on long boundary */
-};
-
 struct macb {
 	void __iomem		*regs;
 
@@ -558,11 +550,6 @@ struct macb {
 	struct sk_buff *skb;			/* holds skb until xmit interrupt completes */
 	dma_addr_t skb_physaddr;		/* phys addr from pci_map_single */
 	int skb_length;				/* saved skb length for pci_unmap_single */
-
-	/* Receive */
-	int rxBuffIndex;			/* index into receive descriptor list */
-	struct recv_desc_bufs *dlist;		/* descriptor list address */
-	struct recv_desc_bufs *dlist_phys;	/* descriptor list physical address */
 };
 
 extern const struct ethtool_ops macb_ethtool_ops;
-- 
1.7.12.3

^ permalink raw reply related

* [PATCH 11/14] net/at91_ether: use macb dma description struct
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/cadence/at91_ether.c | 6 +++---
 drivers/net/ethernet/cadence/macb.h       | 7 +------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index f340d24..8204b8a 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -157,7 +157,7 @@ static void at91ether_start(struct net_device *dev)
 
 	for (i = 0; i < MAX_RX_DESCR; i++) {
 		dlist->descriptors[i].addr = (unsigned int) &dlist_phys->recv_buf[i][0];
-		dlist->descriptors[i].size = 0;
+		dlist->descriptors[i].ctrl = 0;
 	}
 
 	/* Set the Wrap bit on the last descriptor */
@@ -311,7 +311,7 @@ static void at91ether_rx(struct net_device *dev)
 	dlist = lp->dlist;
 	while (dlist->descriptors[lp->rxBuffIndex].addr & MACB_BIT(RX_USED)) {
 		p_recv = dlist->recv_buf[lp->rxBuffIndex];
-		pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff;	/* Length of frame including FCS */
+		pktlen = dlist->descriptors[lp->rxBuffIndex].ctrl & 0x7ff;	/* Length of frame including FCS */
 		skb = netdev_alloc_skb(dev, pktlen + 2);
 		if (skb != NULL) {
 			skb_reserve(skb, 2);
@@ -326,7 +326,7 @@ static void at91ether_rx(struct net_device *dev)
 			printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
 		}
 
-		if (dlist->descriptors[lp->rxBuffIndex].size & MACB_BIT(RX_MHASH_MATCH))
+		if (dlist->descriptors[lp->rxBuffIndex].ctrl & MACB_BIT(RX_MHASH_MATCH))
 			dev->stats.multicast++;
 
 		dlist->descriptors[lp->rxBuffIndex].addr &= ~MACB_BIT(RX_USED);	/* reset ownership bit */
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 2710562..31a877a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -504,16 +504,11 @@ struct gem_stats {
 	u32	rx_udp_checksum_errors;
 };
 
-struct rbf_t {
-	unsigned int addr;
-	unsigned long size;
-};
-
 #define MAX_RBUFF_SZ	0x600		/* 1518 rounded up */
 #define MAX_RX_DESCR	9		/* max number of receive buffers */
 
 struct recv_desc_bufs {
-	struct rbf_t descriptors[MAX_RX_DESCR];		/* must be on sizeof (rbf_t) boundary */
+	struct dma_desc descriptors[MAX_RX_DESCR];	/* must be on sizeof (dma_desc) boundary */
 	char recv_buf[MAX_RX_DESCR][MAX_RBUFF_SZ];	/* must be on long boundary */
 };
 
-- 
1.7.12.3

^ permalink raw reply related

* [PATCH 10/14] net/at91_ether: share macb_set_rx_mode with macb
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/cadence/at91_ether.c | 107 +-----------------------------
 drivers/net/ethernet/cadence/macb.c       |   3 +-
 drivers/net/ethernet/cadence/macb.h       |   1 +
 3 files changed, 4 insertions(+), 107 deletions(-)

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index a1e0949..f340d24 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -140,111 +140,6 @@ static int set_mac_address(struct net_device *dev, void* addr)
 	return 0;
 }
 
-static int inline hash_bit_value(int bitnr, __u8 *addr)
-{
-	if (addr[bitnr / 8] & (1 << (bitnr % 8)))
-		return 1;
-	return 0;
-}
-
-/*
- * The hash address register is 64 bits long and takes up two locations in the memory map.
- * The least significant bits are stored in EMAC_HSL and the most significant
- * bits in EMAC_HSH.
- *
- * The unicast hash enable and the multicast hash enable bits in the network configuration
- *  register enable the reception of hash matched frames. The destination address is
- *  reduced to a 6 bit index into the 64 bit hash register using the following hash function.
- * The hash function is an exclusive or of every sixth bit of the destination address.
- *   hash_index[5] = da[5] ^ da[11] ^ da[17] ^ da[23] ^ da[29] ^ da[35] ^ da[41] ^ da[47]
- *   hash_index[4] = da[4] ^ da[10] ^ da[16] ^ da[22] ^ da[28] ^ da[34] ^ da[40] ^ da[46]
- *   hash_index[3] = da[3] ^ da[09] ^ da[15] ^ da[21] ^ da[27] ^ da[33] ^ da[39] ^ da[45]
- *   hash_index[2] = da[2] ^ da[08] ^ da[14] ^ da[20] ^ da[26] ^ da[32] ^ da[38] ^ da[44]
- *   hash_index[1] = da[1] ^ da[07] ^ da[13] ^ da[19] ^ da[25] ^ da[31] ^ da[37] ^ da[43]
- *   hash_index[0] = da[0] ^ da[06] ^ da[12] ^ da[18] ^ da[24] ^ da[30] ^ da[36] ^ da[42]
- * da[0] represents the least significant bit of the first byte received, that is, the multicast/
- *  unicast indicator, and da[47] represents the most significant bit of the last byte
- *  received.
- * If the hash index points to a bit that is set in the hash register then the frame will be
- *  matched according to whether the frame is multicast or unicast.
- * A multicast match will be signalled if the multicast hash enable bit is set, da[0] is 1 and
- *  the hash index points to a bit set in the hash register.
- * A unicast match will be signalled if the unicast hash enable bit is set, da[0] is 0 and the
- *  hash index points to a bit set in the hash register.
- * To receive all multicast frames, the hash register should be set with all ones and the
- *  multicast hash enable bit should be set in the network configuration register.
- */
-
-/*
- * Return the hash index value for the specified address.
- */
-static int hash_get_index(__u8 *addr)
-{
-	int i, j, bitval;
-	int hash_index = 0;
-
-	for (j = 0; j < 6; j++) {
-		for (i = 0, bitval = 0; i < 8; i++)
-			bitval ^= hash_bit_value(i*6 + j, addr);
-
-		hash_index |= (bitval << j);
-	}
-
-	return hash_index;
-}
-
-/*
- * Add multicast addresses to the internal multicast-hash table.
- */
-static void at91ether_sethashtable(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	struct netdev_hw_addr *ha;
-	unsigned long mc_filter[2];
-	unsigned int bitnr;
-
-	mc_filter[0] = mc_filter[1] = 0;
-
-	netdev_for_each_mc_addr(ha, dev) {
-		bitnr = hash_get_index(ha->addr);
-		mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
-	}
-
-	macb_writel(lp, HRB, mc_filter[0]);
-	macb_writel(lp, HRT, mc_filter[1]);
-}
-
-/*
- * Enable/Disable promiscuous and multicast modes.
- */
-static void at91ether_set_multicast_list(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned long cfg;
-
-	cfg = macb_readl(lp, NCFGR);
-
-	if (dev->flags & IFF_PROMISC)			/* Enable promiscuous mode */
-		cfg |= MACB_BIT(CAF);
-	else if (dev->flags & (~IFF_PROMISC))		/* Disable promiscuous mode */
-		cfg &= ~MACB_BIT(CAF);
-
-	if (dev->flags & IFF_ALLMULTI) {		/* Enable all multicast mode */
-		macb_writel(lp, HRT, -1);
-		macb_writel(lp, HRB, -1);
-		cfg |= MACB_BIT(NCFGR_MTI);
-	} else if (!netdev_mc_empty(dev)) { /* Enable specific multicasts */
-		at91ether_sethashtable(dev);
-		cfg |= MACB_BIT(NCFGR_MTI);
-	} else if (dev->flags & (~IFF_ALLMULTI)) {	/* Disable all multicast mode */
-		macb_writel(lp, HRT, 0);
-		macb_writel(lp, HRB, 0);
-		cfg &= ~MACB_BIT(NCFGR_MTI);
-	}
-
-	macb_writel(lp, NCFGR, cfg);
-}
-
 /* ................................ MAC ................................ */
 
 /*
@@ -500,7 +395,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
 	.ndo_stop		= at91ether_close,
 	.ndo_start_xmit		= at91ether_start_xmit,
 	.ndo_get_stats		= at91ether_stats,
-	.ndo_set_rx_mode	= at91ether_set_multicast_list,
+	.ndo_set_rx_mode	= macb_set_rx_mode,
 	.ndo_set_mac_address	= set_mac_address,
 	.ndo_do_ioctl		= macb_ioctl,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 8ee6de5..6c84a11 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -997,7 +997,7 @@ static void macb_sethashtable(struct net_device *dev)
 /*
  * Enable/Disable promiscuous and multicast modes.
  */
-static void macb_set_rx_mode(struct net_device *dev)
+void macb_set_rx_mode(struct net_device *dev)
 {
 	unsigned long cfg;
 	struct macb *bp = netdev_priv(dev);
@@ -1029,6 +1029,7 @@ static void macb_set_rx_mode(struct net_device *dev)
 
 	macb_writel(bp, NCFGR, cfg);
 }
+EXPORT_SYMBOL_GPL(macb_set_rx_mode);
 
 static int macb_open(struct net_device *dev)
 {
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index fd2961a..2710562 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -574,6 +574,7 @@ extern const struct ethtool_ops macb_ethtool_ops;
 
 int macb_mii_init(struct macb *bp);
 int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+void macb_set_rx_mode(struct net_device *dev);
 
 static inline bool macb_is_gem(struct macb *bp)
 {
-- 
1.7.12.3

^ permalink raw reply related

* [PATCH 09/14] net/at91_ether: use ethtool and mdio from macb
From: Joachim Eastwood @ 2012-10-18 21:01 UTC (permalink / raw)
  To: nicolas.ferre, davem; +Cc: netdev, Joachim Eastwood
In-Reply-To: <1350594079-4337-1-git-send-email-manabian@gmail.com>

This rips out the at91_ether phy handling and ethtool stuff
and replace it with equivalent stuff from macb.

The only thing lost is the phy irq support from at91_ether,
but this can be added to macb and then benefit all users.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/cadence/at91_ether.c | 636 ++----------------------------
 drivers/net/ethernet/cadence/at91_ether.h |  61 ---
 drivers/net/ethernet/cadence/macb.h       |   7 -
 3 files changed, 31 insertions(+), 673 deletions(-)
 delete mode 100644 drivers/net/ethernet/cadence/at91_ether.h

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 4da36b8..a1e0949 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/mii.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
@@ -36,382 +35,11 @@
 #include <asm/uaccess.h>
 #include <asm/mach-types.h>
 
-#include <asm/gpio.h>
-#include <mach/board.h>
-
-#include "at91_ether.h"
 #include "macb.h"
 
 #define DRV_NAME	"at91_ether"
 #define DRV_VERSION	"1.0"
 
-#define LINK_POLL_INTERVAL	(HZ)
-
-/* ........................... PHY INTERFACE ........................... */
-
-/*
- * Enable the MDIO bit in MAC control register
- * When not called from an interrupt-handler, access to the PHY must be
- *  protected by a spinlock.
- */
-static void enable_mdi(struct macb *lp)
-{
-	unsigned long ctl;
-
-	ctl = macb_readl(lp, NCR);
-	macb_writel(lp, NCR, ctl | MACB_BIT(MPE));	/* enable management port */
-}
-
-/*
- * Disable the MDIO bit in the MAC control register
- */
-static void disable_mdi(struct macb *lp)
-{
-	unsigned long ctl;
-
-	ctl = macb_readl(lp, NCR);
-	macb_writel(lp, NCR, ctl & ~MACB_BIT(MPE));	/* disable management port */
-}
-
-/*
- * Wait until the PHY operation is complete.
- */
-static inline void at91_phy_wait(struct macb *lp)
-{
-	unsigned long timeout = jiffies + 2;
-
-	while (!(macb_readl(lp, NSR) & MACB_BIT(IDLE))) {
-		if (time_after(jiffies, timeout)) {
-			printk("at91_ether: MIO timeout\n");
-			break;
-		}
-		cpu_relax();
-	}
-}
-
-/*
- * Write value to the a PHY register
- * Note: MDI interface is assumed to already have been enabled.
- */
-static void write_phy(struct macb *lp, unsigned char phy_addr, unsigned char address, unsigned int value)
-{
-	macb_writel(lp, MAN, MACB_BF(SOF, MACB_MAN_SOF) | MACB_BF(CODE, MACB_MAN_CODE)
-					| MACB_BF(RW, MACB_MAN_WRITE) | ((phy_addr & 0x1f) << 23)
-					| (address << 18) | (value & ((1<<MACB_DATA_SIZE) - 1)));
-
-	/* Wait until IDLE bit in Network Status register is cleared */
-	at91_phy_wait(lp);
-}
-
-/*
- * Read value stored in a PHY register.
- * Note: MDI interface is assumed to already have been enabled.
- */
-static void read_phy(struct macb *lp, unsigned char phy_addr, unsigned char address, unsigned int *value)
-{
-	macb_writel(lp, MAN, MACB_BF(SOF, MACB_MAN_SOF) | MACB_BF(CODE, MACB_MAN_CODE)
-					| MACB_BF(RW, MACB_MAN_READ) | ((phy_addr & 0x1f) << 23)
-					| (address << 18));
-
-	/* Wait until IDLE bit in Network Status register is cleared */
-	at91_phy_wait(lp);
-
-	*value = macb_readl(lp, MAN) & ((1<<MACB_DATA_SIZE) - 1);
-}
-
-/* ........................... PHY MANAGEMENT .......................... */
-
-/*
- * Access the PHY to determine the current link speed and mode, and update the
- * MAC accordingly.
- * If no link or auto-negotiation is busy, then no changes are made.
- */
-static void update_linkspeed(struct net_device *dev, int silent)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned int bmsr, bmcr, lpa, mac_cfg;
-	unsigned int speed, duplex;
-
-	if (!mii_link_ok(&lp->mii)) {		/* no link */
-		netif_carrier_off(dev);
-		if (!silent)
-			printk(KERN_INFO "%s: Link down.\n", dev->name);
-		return;
-	}
-
-	/* Link up, or auto-negotiation still in progress */
-	read_phy(lp, lp->phy_address, MII_BMSR, &bmsr);
-	read_phy(lp, lp->phy_address, MII_BMCR, &bmcr);
-	if (bmcr & BMCR_ANENABLE) {				/* AutoNegotiation is enabled */
-		if (!(bmsr & BMSR_ANEGCOMPLETE))
-			return;			/* Do nothing - another interrupt generated when negotiation complete */
-
-		read_phy(lp, lp->phy_address, MII_LPA, &lpa);
-		if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) speed = SPEED_100;
-		else speed = SPEED_10;
-		if ((lpa & LPA_100FULL) || (lpa & LPA_10FULL)) duplex = DUPLEX_FULL;
-		else duplex = DUPLEX_HALF;
-	} else {
-		speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
-		duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
-	}
-
-	/* Update the MAC */
-	mac_cfg = macb_readl(lp, NCFGR) & ~(MACB_BIT(SPD) | MACB_BIT(FD));
-	if (speed == SPEED_100) {
-		if (duplex == DUPLEX_FULL)		/* 100 Full Duplex */
-			mac_cfg |= MACB_BIT(SPD) | MACB_BIT(FD);
-		else					/* 100 Half Duplex */
-			mac_cfg |= MACB_BIT(SPD);
-	} else {
-		if (duplex == DUPLEX_FULL)		/* 10 Full Duplex */
-			mac_cfg |= MACB_BIT(FD);
-		else {}					/* 10 Half Duplex */
-	}
-	macb_writel(lp, NCFGR, mac_cfg);
-
-	if (!silent)
-		printk(KERN_INFO "%s: Link now %i-%s\n", dev->name, speed, (duplex == DUPLEX_FULL) ? "FullDuplex" : "HalfDuplex");
-	netif_carrier_on(dev);
-}
-
-/*
- * Handle interrupts from the PHY
- */
-static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id)
-{
-	struct net_device *dev = (struct net_device *) dev_id;
-	struct macb *lp = netdev_priv(dev);
-	unsigned int phy;
-
-	/*
-	 * This hander is triggered on both edges, but the PHY chips expect
-	 * level-triggering.  We therefore have to check if the PHY actually has
-	 * an IRQ pending.
-	 */
-	enable_mdi(lp);
-	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {
-		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &phy);	/* ack interrupt in Davicom PHY */
-		if (!(phy & (1 << 0)))
-			goto done;
-	}
-	else if (lp->phy_type == MII_LXT971A_ID) {
-		read_phy(lp, lp->phy_address, MII_ISINTS_REG, &phy);	/* ack interrupt in Intel PHY */
-		if (!(phy & (1 << 2)))
-			goto done;
-	}
-	else if (lp->phy_type == MII_BCM5221_ID) {
-		read_phy(lp, lp->phy_address, MII_BCMINTR_REG, &phy);	/* ack interrupt in Broadcom PHY */
-		if (!(phy & (1 << 0)))
-			goto done;
-	}
-	else if (lp->phy_type == MII_KS8721_ID) {
-		read_phy(lp, lp->phy_address, MII_TPISTATUS, &phy);		/* ack interrupt in Micrel PHY */
-		if (!(phy & ((1 << 2) | 1)))
-			goto done;
-	}
-	else if (lp->phy_type == MII_T78Q21x3_ID) {					/* ack interrupt in Teridian PHY */
-		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &phy);
-		if (!(phy & ((1 << 2) | 1)))
-			goto done;
-	}
-	else if (lp->phy_type == MII_DP83848_ID) {
-		read_phy(lp, lp->phy_address, MII_DPPHYSTS_REG, &phy);	/* ack interrupt in DP83848 PHY */
-		if (!(phy & (1 << 7)))
-			goto done;
-	}
-
-	update_linkspeed(dev, 0);
-
-done:
-	disable_mdi(lp);
-
-	return IRQ_HANDLED;
-}
-
-/*
- * Initialize and enable the PHY interrupt for link-state changes
- */
-static void enable_phyirq(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned int dsintr, irq_number;
-	int status;
-
-	if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
-		/*
-		 * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L),
-		 * or board does not have it connected.
-		 */
-		mod_timer(&lp->check_timer, jiffies + LINK_POLL_INTERVAL);
-		return;
-	}
-
-	irq_number = gpio_to_irq(lp->board_data.phy_irq_pin);
-	status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev);
-	if (status) {
-		printk(KERN_ERR "at91_ether: PHY IRQ %d request failed - status %d!\n", irq_number, status);
-		return;
-	}
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {	/* for Davicom PHY */
-		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &dsintr);
-		dsintr = dsintr & ~0xf00;		/* clear bits 8..11 */
-		write_phy(lp, lp->phy_address, MII_DSINTR_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_LXT971A_ID) {	/* for Intel PHY */
-		read_phy(lp, lp->phy_address, MII_ISINTE_REG, &dsintr);
-		dsintr = dsintr | 0xf2;			/* set bits 1, 4..7 */
-		write_phy(lp, lp->phy_address, MII_ISINTE_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_BCM5221_ID) {	/* for Broadcom PHY */
-		dsintr = (1 << 15) | ( 1 << 14);
-		write_phy(lp, lp->phy_address, MII_BCMINTR_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_KS8721_ID) {	/* for Micrel PHY */
-		dsintr = (1 << 10) | ( 1 << 8);
-		write_phy(lp, lp->phy_address, MII_TPISTATUS, dsintr);
-	}
-	else if (lp->phy_type == MII_T78Q21x3_ID) {	/* for Teridian PHY */
-		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &dsintr);
-		dsintr = dsintr | 0x500;		/* set bits 8, 10 */
-		write_phy(lp, lp->phy_address, MII_T78Q21INT_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_DP83848_ID) {	/* National Semiconductor DP83848 PHY */
-		read_phy(lp, lp->phy_address, MII_DPMISR_REG, &dsintr);
-		dsintr = dsintr | 0x3c;			/* set bits 2..5 */
-		write_phy(lp, lp->phy_address, MII_DPMISR_REG, dsintr);
-		read_phy(lp, lp->phy_address, MII_DPMICR_REG, &dsintr);
-		dsintr = dsintr | 0x3;			/* set bits 0,1 */
-		write_phy(lp, lp->phy_address, MII_DPMICR_REG, dsintr);
-	}
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-}
-
-/*
- * Disable the PHY interrupt
- */
-static void disable_phyirq(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned int dsintr;
-	unsigned int irq_number;
-
-	if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
-		del_timer_sync(&lp->check_timer);
-		return;
-	}
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {	/* for Davicom PHY */
-		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &dsintr);
-		dsintr = dsintr | 0xf00;			/* set bits 8..11 */
-		write_phy(lp, lp->phy_address, MII_DSINTR_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_LXT971A_ID) {	/* for Intel PHY */
-		read_phy(lp, lp->phy_address, MII_ISINTE_REG, &dsintr);
-		dsintr = dsintr & ~0xf2;			/* clear bits 1, 4..7 */
-		write_phy(lp, lp->phy_address, MII_ISINTE_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_BCM5221_ID) {	/* for Broadcom PHY */
-		read_phy(lp, lp->phy_address, MII_BCMINTR_REG, &dsintr);
-		dsintr = ~(1 << 14);
-		write_phy(lp, lp->phy_address, MII_BCMINTR_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_KS8721_ID) {	/* for Micrel PHY */
-		read_phy(lp, lp->phy_address, MII_TPISTATUS, &dsintr);
-		dsintr = ~((1 << 10) | (1 << 8));
-		write_phy(lp, lp->phy_address, MII_TPISTATUS, dsintr);
-	}
-	else if (lp->phy_type == MII_T78Q21x3_ID) {	/* for Teridian PHY */
-		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &dsintr);
-		dsintr = dsintr & ~0x500;			/* clear bits 8, 10 */
-		write_phy(lp, lp->phy_address, MII_T78Q21INT_REG, dsintr);
-	}
-	else if (lp->phy_type == MII_DP83848_ID) {	/* National Semiconductor DP83848 PHY */
-		read_phy(lp, lp->phy_address, MII_DPMICR_REG, &dsintr);
-		dsintr = dsintr & ~0x3;				/* clear bits 0, 1 */
-		write_phy(lp, lp->phy_address, MII_DPMICR_REG, dsintr);
-		read_phy(lp, lp->phy_address, MII_DPMISR_REG, &dsintr);
-		dsintr = dsintr & ~0x3c;			/* clear bits 2..5 */
-		write_phy(lp, lp->phy_address, MII_DPMISR_REG, dsintr);
-	}
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
-	irq_number = gpio_to_irq(lp->board_data.phy_irq_pin);
-	free_irq(irq_number, dev);			/* Free interrupt handler */
-}
-
-/*
- * Perform a software reset of the PHY.
- */
-#if 0
-static void reset_phy(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned int bmcr;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	/* Perform PHY reset */
-	write_phy(lp, lp->phy_address, MII_BMCR, BMCR_RESET);
-
-	/* Wait until PHY reset is complete */
-	do {
-		read_phy(lp, lp->phy_address, MII_BMCR, &bmcr);
-	} while (!(bmcr & BMCR_RESET));
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-}
-#endif
-
-static void at91ether_check_link(unsigned long dev_id)
-{
-	struct net_device *dev = (struct net_device *) dev_id;
-	struct macb *lp = netdev_priv(dev);
-
-	enable_mdi(lp);
-	update_linkspeed(dev, 1);
-	disable_mdi(lp);
-
-	mod_timer(&lp->check_timer, jiffies + LINK_POLL_INTERVAL);
-}
-
-/*
- * Perform any PHY-specific initialization.
- */
-static void __init initialize_phy(struct macb *lp)
-{
-	unsigned int val;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {
-		read_phy(lp, lp->phy_address, MII_DSCR_REG, &val);
-		if ((val & (1 << 10)) == 0)			/* DSCR bit 10 is 0 -- fiber mode */
-			lp->phy_media = PORT_FIBRE;
-	} else if (machine_is_csb337()) {
-		/* mix link activity status into LED2 link state */
-		write_phy(lp, lp->phy_address, MII_LEDCTRL_REG, 0x0d22);
-	} else if (machine_is_ecbat91())
-		write_phy(lp, lp->phy_address, MII_LEDCTRL_REG, 0x156A);
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-}
-
 /* ......................... ADDRESS MANAGEMENT ........................ */
 
 /*
@@ -617,109 +245,6 @@ static void at91ether_set_multicast_list(struct net_device *dev)
 	macb_writel(lp, NCFGR, cfg);
 }
 
-/* ......................... ETHTOOL SUPPORT ........................... */
-
-static int mdio_read(struct net_device *dev, int phy_id, int location)
-{
-	struct macb *lp = netdev_priv(dev);
-	unsigned int value;
-
-	read_phy(lp, phy_id, location, &value);
-	return value;
-}
-
-static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
-{
-	struct macb *lp = netdev_priv(dev);
-
-	write_phy(lp, phy_id, location, value);
-}
-
-static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-	struct macb *lp = netdev_priv(dev);
-	int ret;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	ret = mii_ethtool_gset(&lp->mii, cmd);
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
-	if (lp->phy_media == PORT_FIBRE) {		/* override media type since mii.c doesn't know */
-		cmd->supported = SUPPORTED_FIBRE;
-		cmd->port = PORT_FIBRE;
-	}
-
-	return ret;
-}
-
-static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-	struct macb *lp = netdev_priv(dev);
-	int ret;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	ret = mii_ethtool_sset(&lp->mii, cmd);
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
-	return ret;
-}
-
-static int at91ether_nwayreset(struct net_device *dev)
-{
-	struct macb *lp = netdev_priv(dev);
-	int ret;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-
-	ret = mii_nway_restart(&lp->mii);
-
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
-	return ret;
-}
-
-static void at91ether_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
-{
-	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
-	strlcpy(info->version, DRV_VERSION, sizeof(info->version));
-	strlcpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
-}
-
-static const struct ethtool_ops at91ether_ethtool_ops = {
-	.get_settings	= at91ether_get_settings,
-	.set_settings	= at91ether_set_settings,
-	.get_drvinfo	= at91ether_get_drvinfo,
-	.nway_reset	= at91ether_nwayreset,
-	.get_link	= ethtool_op_get_link,
-};
-
-static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	struct macb *lp = netdev_priv(dev);
-	int res;
-
-	if (!netif_running(dev))
-		return -EINVAL;
-
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-	res = generic_mii_ioctl(&lp->mii, if_mii(rq), cmd, NULL);
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
-	return res;
-}
-
 /* ................................ MAC ................................ */
 
 /*
@@ -765,8 +290,6 @@ static int at91ether_open(struct net_device *dev)
 	if (!is_valid_ether_addr(dev->dev_addr))
 		return -EADDRNOTAVAIL;
 
-	clk_enable(lp->pclk);		/* Re-enable Peripheral clock */
-
 	/* Clear internal statistics */
 	ctl = macb_readl(lp, NCR);
 	macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
@@ -774,23 +297,18 @@ static int at91ether_open(struct net_device *dev)
 	/* Update the MAC address (incase user has changed it) */
 	update_mac_address(dev);
 
-	/* Enable PHY interrupt */
-	enable_phyirq(dev);
-
 	/* Enable MAC interrupts */
 	macb_writel(lp, IER, MACB_BIT(RCOMP) | MACB_BIT(RXUBR)
 				| MACB_BIT(ISR_TUND) | MACB_BIT(ISR_RLE) | MACB_BIT(TCOMP)
 				| MACB_BIT(ISR_ROVR) | MACB_BIT(HRESP));
 
-	/* Determine current link speed */
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-	update_linkspeed(dev, 0);
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
-
 	at91ether_start(dev);
+
+	/* schedule a link state check */
+	phy_start(lp->phy_dev);
+
 	netif_start_queue(dev);
+
 	return 0;
 }
 
@@ -806,9 +324,6 @@ static int at91ether_close(struct net_device *dev)
 	ctl = macb_readl(lp, NCR);
 	macb_writel(lp, NCR, ctl & ~(MACB_BIT(TE) | MACB_BIT(RE)));
 
-	/* Disable PHY interrupt */
-	disable_phyirq(dev);
-
 	/* Disable MAC interrupts */
 	macb_writel(lp, IDR, MACB_BIT(RCOMP) | MACB_BIT(RXUBR)
 				| MACB_BIT(ISR_TUND) | MACB_BIT(ISR_RLE)
@@ -817,8 +332,6 @@ static int at91ether_close(struct net_device *dev)
 
 	netif_stop_queue(dev);
 
-	clk_disable(lp->pclk);		/* Disable Peripheral clock */
-
 	return 0;
 }
 
@@ -989,7 +502,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
 	.ndo_get_stats		= at91ether_stats,
 	.ndo_set_rx_mode	= at91ether_set_multicast_list,
 	.ndo_set_mac_address	= set_mac_address,
-	.ndo_do_ioctl		= at91ether_ioctl,
+	.ndo_do_ioctl		= macb_ioctl,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_change_mtu		= eth_change_mtu,
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -998,48 +511,6 @@ static const struct net_device_ops at91ether_netdev_ops = {
 };
 
 /*
- * Detect the PHY type, and its address.
- */
-static int __init at91ether_phy_detect(struct macb *lp)
-{
-	unsigned int phyid1, phyid2;
-	unsigned long phy_id;
-	unsigned short phy_address = 0;
-
-	while (phy_address < PHY_MAX_ADDR) {
-		/* Read the PHY ID registers */
-		enable_mdi(lp);
-		read_phy(lp, phy_address, MII_PHYSID1, &phyid1);
-		read_phy(lp, phy_address, MII_PHYSID2, &phyid2);
-		disable_mdi(lp);
-
-		phy_id = (phyid1 << 16) | (phyid2 & 0xfff0);
-		switch (phy_id) {
-			case MII_DM9161_ID:		/* Davicom 9161: PHY_ID1 = 0x181, PHY_ID2 = B881 */
-			case MII_DM9161A_ID:		/* Davicom 9161A: PHY_ID1 = 0x181, PHY_ID2 = B8A0 */
-			case MII_LXT971A_ID:		/* Intel LXT971A: PHY_ID1 = 0x13, PHY_ID2 = 78E0 */
-			case MII_RTL8201_ID:		/* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */
-			case MII_BCM5221_ID:		/* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */
-			case MII_DP83847_ID:		/* National Semiconductor DP83847:  */
-			case MII_DP83848_ID:		/* National Semiconductor DP83848:  */
-			case MII_AC101L_ID:		/* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */
-			case MII_KS8721_ID:		/* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */
-			case MII_T78Q21x3_ID:		/* Teridian 78Q21x3: PHY_ID1 = 0x0E, PHY_ID2 = 7237 */
-			case MII_LAN83C185_ID:		/* SMSC LAN83C185: PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */
-				/* store detected values */
-				lp->phy_type = phy_id;		/* Type of PHY connected */
-				lp->phy_address = phy_address;	/* MDI address of PHY */
-				return 1;
-		}
-
-		phy_address++;
-	}
-
-	return 0;		/* not detected */
-}
-
-
-/*
  * Detect MAC & PHY and perform ethernet interface initialization
  */
 static int __init at91ether_probe(struct platform_device *pdev)
@@ -1047,6 +518,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	struct macb_platform_data *board_data = pdev->dev.platform_data;
 	struct resource *regs;
 	struct net_device *dev;
+	struct phy_device *phydev;
 	struct macb *lp;
 	int res;
 
@@ -1059,6 +531,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	lp = netdev_priv(dev);
+	lp->pdev = pdev;
+	lp->dev = dev;
 	lp->board_data = *board_data;
 	spin_lock_init(&lp->lock);
 
@@ -1093,7 +567,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 
 	ether_setup(dev);
 	dev->netdev_ops = &at91ether_netdev_ops;
-	dev->ethtool_ops = &at91ether_ethtool_ops;
+	dev->ethtool_ops = &macb_ethtool_ops;
 	platform_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
@@ -1102,49 +576,27 @@ static int __init at91ether_probe(struct platform_device *pdev)
 
 	macb_writel(lp, NCR, 0);
 
-	if (board_data->is_rmii)
+	if (board_data->is_rmii) {
 		macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG) | MACB_BIT(RM9200_RMII));
-	else
+		lp->phy_interface = PHY_INTERFACE_MODE_RMII;
+	} else {
 		macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG));
-
-	/* Detect PHY */
-	if (!at91ether_phy_detect(lp)) {
-		printk(KERN_ERR "at91_ether: Could not detect ethernet PHY\n");
-		res = -ENODEV;
-		goto err_free_dmamem;
+		lp->phy_interface = PHY_INTERFACE_MODE_MII;
 	}
 
-	initialize_phy(lp);
-
-	lp->mii.dev = dev;		/* Support for ethtool */
-	lp->mii.mdio_read = mdio_read;
-	lp->mii.mdio_write = mdio_write;
-	lp->mii.phy_id = lp->phy_address;
-	lp->mii.phy_id_mask = 0x1f;
-	lp->mii.reg_num_mask = 0x1f;
-
 	/* Register the network interface */
 	res = register_netdev(dev);
 	if (res)
 		goto err_free_dmamem;
 
-	/* Determine current link speed */
-	spin_lock_irq(&lp->lock);
-	enable_mdi(lp);
-	update_linkspeed(dev, 0);
-	disable_mdi(lp);
-	spin_unlock_irq(&lp->lock);
+	if (macb_mii_init(lp) != 0)
+		goto err_out_unregister_netdev;
+
 	netif_carrier_off(dev);		/* will be enabled in open() */
 
-	/* If board has no PHY IRQ, use a timer to poll the PHY */
-	if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
-		gpio_request(board_data->phy_irq_pin, "ethernet_phy");
-	} else {
-		/* If board has no PHY IRQ, use a timer to poll the PHY */
-		init_timer(&lp->check_timer);
-		lp->check_timer.data = (unsigned long)dev;
-		lp->check_timer.function = at91ether_check_link;
-	}
+	phydev = lp->phy_dev;
+	netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
+		phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
 	/* Display ethernet banner */
 	printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%pM)\n",
@@ -1152,32 +604,11 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	       macb_readl(lp, NCFGR) & MACB_BIT(SPD) ? "100-" : "10-",
 	       macb_readl(lp, NCFGR) & MACB_BIT(FD) ? "FullDuplex" : "HalfDuplex",
 	       dev->dev_addr);
-	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID))
-		printk(KERN_INFO "%s: Davicom 9161 PHY %s\n", dev->name, (lp->phy_media == PORT_FIBRE) ? "(Fiber)" : "(Copper)");
-	else if (lp->phy_type == MII_LXT971A_ID)
-		printk(KERN_INFO "%s: Intel LXT971A PHY\n", dev->name);
-	else if (lp->phy_type == MII_RTL8201_ID)
-		printk(KERN_INFO "%s: Realtek RTL8201(B)L PHY\n", dev->name);
-	else if (lp->phy_type == MII_BCM5221_ID)
-		printk(KERN_INFO "%s: Broadcom BCM5221 PHY\n", dev->name);
-	else if (lp->phy_type == MII_DP83847_ID)
-		printk(KERN_INFO "%s: National Semiconductor DP83847 PHY\n", dev->name);
-	else if (lp->phy_type == MII_DP83848_ID)
-		printk(KERN_INFO "%s: National Semiconductor DP83848 PHY\n", dev->name);
-	else if (lp->phy_type == MII_AC101L_ID)
-		printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name);
-	else if (lp->phy_type == MII_KS8721_ID)
-		printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name);
-	else if (lp->phy_type == MII_T78Q21x3_ID)
-		printk(KERN_INFO "%s: Teridian 78Q21x3 PHY\n", dev->name);
-	else if (lp->phy_type == MII_LAN83C185_ID)
-		printk(KERN_INFO "%s: SMSC LAN83C185 PHY\n", dev->name);
-
-	clk_disable(lp->pclk);					/* Disable Peripheral clock */
 
 	return 0;
 
-
+err_out_unregister_netdev:
+	unregister_netdev(dev);
 err_free_dmamem:
 	platform_set_drvdata(pdev, NULL);
 	dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
@@ -1198,16 +629,21 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct macb *lp = netdev_priv(dev);
 
-	if (gpio_is_valid(lp->board_data.phy_irq_pin))
-		gpio_free(lp->board_data.phy_irq_pin);
+	if (lp->phy_dev)
+		phy_disconnect(lp->phy_dev);
 
+	mdiobus_unregister(lp->mii_bus);
+	kfree(lp->mii_bus->irq);
+	mdiobus_free(lp->mii_bus);
 	unregister_netdev(dev);
 	free_irq(dev->irq, dev);
 	dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
+	iounmap(lp->regs);
+	clk_disable(lp->pclk);
 	clk_put(lp->pclk);
-
-	platform_set_drvdata(pdev, NULL);
 	free_netdev(dev);
+	platform_set_drvdata(pdev, NULL);
+
 	return 0;
 }
 
@@ -1219,11 +655,6 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg)
 	struct macb *lp = netdev_priv(net_dev);
 
 	if (netif_running(net_dev)) {
-		if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
-			int phy_irq = gpio_to_irq(lp->board_data.phy_irq_pin);
-			disable_irq(phy_irq);
-		}
-
 		netif_stop_queue(net_dev);
 		netif_device_detach(net_dev);
 
@@ -1242,11 +673,6 @@ static int at91ether_resume(struct platform_device *pdev)
 
 		netif_device_attach(net_dev);
 		netif_start_queue(net_dev);
-
-		if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
-			int phy_irq = gpio_to_irq(lp->board_data.phy_irq_pin);
-			enable_irq(phy_irq);
-		}
 	}
 	return 0;
 }
diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h
deleted file mode 100644
index 4bc74a3..0000000
--- a/drivers/net/ethernet/cadence/at91_ether.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Ethernet driver for the Atmel AT91RM9200 (Thunder)
- *
- *  Copyright (C) SAN People (Pty) Ltd
- *
- * Based on an earlier Atmel EMAC macrocell driver by Atmel and Lineo Inc.
- * Initial version by Rick Bronson.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef AT91_ETHERNET
-#define AT91_ETHERNET
-
-
-/* Davicom 9161 PHY */
-#define MII_DM9161_ID		0x0181b880
-#define MII_DM9161A_ID		0x0181b8a0
-#define MII_DSCR_REG		16
-#define MII_DSCSR_REG		17
-#define MII_DSINTR_REG		21
-
-/* Intel LXT971A PHY */
-#define MII_LXT971A_ID		0x001378E0
-#define MII_ISINTE_REG		18
-#define MII_ISINTS_REG		19
-#define MII_LEDCTRL_REG		20
-
-/* Realtek RTL8201 PHY */
-#define MII_RTL8201_ID		0x00008200
-
-/* Broadcom BCM5221 PHY */
-#define MII_BCM5221_ID		0x004061e0
-#define MII_BCMINTR_REG		26
-
-/* National Semiconductor DP83847 */
-#define MII_DP83847_ID		0x20005c30
-
-/* National Semiconductor DP83848 */
-#define MII_DP83848_ID		0x20005c90
-#define MII_DPPHYSTS_REG	16
-#define MII_DPMICR_REG		17
-#define MII_DPMISR_REG		18
-
-/* Altima AC101L PHY */
-#define MII_AC101L_ID		0x00225520
-
-/* Micrel KS8721 PHY */
-#define MII_KS8721_ID		0x00221610
-
-/* Teridian 78Q2123/78Q2133 */
-#define MII_T78Q21x3_ID		0x000e7230
-#define MII_T78Q21INT_REG	17
-
-/* SMSC LAN83C185 */
-#define MII_LAN83C185_ID	0x0007C0A0
-
-#endif
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 335d111..fd2961a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -555,17 +555,10 @@ struct macb {
 	phy_interface_t		phy_interface;
 
 	/* at91_private */
-	struct mii_if_info mii;			/* ethtool support */
 	struct macb_platform_data board_data;	/* board-specific
 						 * configuration (shared with
 						 * macb for common data */
 
-	/* PHY */
-	unsigned long phy_type;			/* type of PHY (PHY_ID) */
-	short phy_media;			/* media interface type */
-	unsigned short phy_address;		/* 5-bit MDI address of PHY (0..31) */
-	struct timer_list check_timer;		/* Poll link status */
-
 	/* Transmit */
 	struct sk_buff *skb;			/* holds skb until xmit interrupt completes */
 	dma_addr_t skb_physaddr;		/* phys addr from pci_map_single */
-- 
1.7.12.3

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox