[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF1J0HPxqPinPnieVtw4oGJr9h9vdLg8EDYQmGicZKbrrJS1Qg@mail.gmail.com>
Date: Tue, 4 Jun 2013 20:20:22 +0300
From: Mike Rapoport <mike.rapoport@...ellosystems.com>
To: David Stevens <dlstevens@...ibm.com>
Cc: netdev@...r.kernel.org, netdev-owner@...r.kernel.org,
Stephen Hemminger <stephen@...workplumber.org>,
Thomas Graf <tgraf@...g.ch>
Subject: Re: [RFC] vxlan: convert remote list to list_rcu
On Tue, Jun 04, 2013 at 08:48:06AM -0400, David Stevens wrote:
> Mike Rapoport <mike.rapoport@...ellosystems.com> wrote on 06/04/2013
> 05:18:08 AM:
>
> Actually, we could make it an fdb and also have "use" and "updated"
> stats that way, and/or use the existing fdb code and add an entry
> with MAC "00:00:00:00:00:00" [which is disallowed via the generic
> fdb code, so can't be in the fdb table otherwise].
If I've understood you right it would be something like this:
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8111565..b7801e3 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -80,6 +80,8 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets
received with corrupted ECN");
static unsigned int vxlan_net_id;
+static u8 ALL_ZEROS_MAC[ETH_ALEN];
+
/* per UDP socket information */
struct vxlan_sock {
struct hlist_node hlist;
@@ -1025,13 +1027,10 @@ static netdev_tx_t vxlan_xmit_one(struct
sk_buff *skb, struct net_device *dev,
vni = rdst->remote_vni;
dst = rdst->remote_ip;
- if (!dst) {
- if (did_rsc) {
- /* short-circuited back to local bridge */
- vxlan_encap_bypass(skb, vxlan, vxlan);
- return NETDEV_TX_OK;
- }
- goto drop;
+ if (did_rsc) {
+ /* short-circuited back to local bridge */
+ vxlan_encap_bypass(skb, vxlan, vxlan);
+ return NETDEV_TX_OK;
}
if (!skb->encapsulation) {
@@ -1174,14 +1173,19 @@ static netdev_tx_t vxlan_xmit(struct sk_buff
*skb, struct net_device *dev)
}
if (f == NULL) {
- rdst0 = &vxlan->default_dst;
+ f = vxlan_find_mac(vxlan, ALL_ZEROS_MAC);
+ if (f == NULL) {
+ if ((vxlan->flags & VXLAN_F_L2MISS) &&
+ !is_multicast_ether_addr(eth->h_dest))
+ vxlan_fdb_miss(vxlan, eth->h_dest);
+
+ dev->stats.tx_dropped++;
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
+ }
- if (rdst0->remote_ip == htonl(INADDR_ANY) &&
- (vxlan->flags & VXLAN_F_L2MISS) &&
- !is_multicast_ether_addr(eth->h_dest))
- vxlan_fdb_miss(vxlan, eth->h_dest);
- } else
- rdst0 = &f->remote;
+ rdst0 = &f->remote;
rc = NETDEV_TX_OK;
@@ -1590,6 +1594,17 @@ static int vxlan_newlink(struct net *net,
struct net_device *dev,
return -EEXIST;
}
+ if (dst->remote_ip != htonl(INADDR_ANY)) {
+ err = vxlan_fdb_create(vxlan, ALL_ZEROS_MAC, dst->remote_ip,
+ NUD_REACHABLE,
+ NLM_F_EXCL|NLM_F_CREATE,
+ dst->remote_port,
+ dst->remote_vni,
+ 0, NTF_SELF);
+ if (err)
+ return err;
+ }
+
vs = vxlan_find_port(net, vxlan->dst_port);
if (vs)
++vs->refcnt;
>
--
Sincerely yours,
Mike.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists