* [PATCH 13/16] batman-adv: add broadcast duplicate check
From: Antonio Quartulli @ 2012-04-11 12:50 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Simon Wunderlich
In-Reply-To: <1334148649-25443-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Simon Wunderlich <simon.wunderlich-Y4E02TeZ33kaBlGTGt4zH4SGEyLTKazZ@public.gmane.org>
When multiple backbone gateways relay the same broadcast from the
backbone into the mesh, other nodes in the mesh may receive this
broadcast multiple times. To avoid this, the crc checksums of
received broadcasts are recorded and new broadcast packets with
the same content may be dropped if received by another gateway.
Signed-off-by: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bridge_loop_avoidance.c | 75 ++++++++++++++++++++++++++++++++
net/batman-adv/bridge_loop_avoidance.h | 2 +
net/batman-adv/main.h | 3 ++
net/batman-adv/routing.c | 4 ++
net/batman-adv/types.h | 7 +++
5 files changed, 91 insertions(+)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 6186f6e..4f6b44a 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1041,8 +1041,16 @@ out:
/* initialize all bla structures */
int bla_init(struct bat_priv *bat_priv)
{
+ int i;
+
bat_dbg(DBG_BLA, bat_priv, "bla hash registering\n");
+ /* initialize the duplicate list */
+ for (i = 0; i < DUPLIST_SIZE; i++)
+ bat_priv->bcast_duplist[i].entrytime =
+ jiffies - msecs_to_jiffies(DUPLIST_TIMEOUT);
+ bat_priv->bcast_duplist_curr = 0;
+
if (bat_priv->claim_hash)
return 1;
@@ -1060,6 +1068,73 @@ int bla_init(struct bat_priv *bat_priv)
/**
* @bat_priv: the bat priv with all the soft interface information
+ * @bcast_packet: originator mac address
+ * @hdr_size: maximum length of the frame
+ *
+ * check if it is on our broadcast list. Another gateway might
+ * have sent the same packet because it is connected to the same backbone,
+ * so we have to remove this duplicate.
+ *
+ * This is performed by checking the CRC, which will tell us
+ * with a good chance that it is the same packet. If it is furthermore
+ * sent by another host, drop it. We allow equal packets from
+ * the same host however as this might be intended.
+ *
+ **/
+
+int bla_check_bcast_duplist(struct bat_priv *bat_priv,
+ struct bcast_packet *bcast_packet,
+ int hdr_size)
+{
+ int i, length, curr;
+ uint8_t *content;
+ uint16_t crc;
+ struct bcast_duplist_entry *entry;
+
+ length = hdr_size - sizeof(*bcast_packet);
+ content = (uint8_t *)bcast_packet;
+ content += sizeof(*bcast_packet);
+
+ /* calculate the crc ... */
+ crc = crc16(0, content, length);
+
+ for (i = 0 ; i < DUPLIST_SIZE; i++) {
+ curr = (bat_priv->bcast_duplist_curr + i) % DUPLIST_SIZE;
+ entry = &bat_priv->bcast_duplist[curr];
+
+ /* we can stop searching if the entry is too old ;
+ * later entries will be even older
+ */
+ if (has_timed_out(entry->entrytime, DUPLIST_TIMEOUT))
+ break;
+
+ if (entry->crc != crc)
+ continue;
+
+ if (compare_eth(entry->orig, bcast_packet->orig))
+ continue;
+
+ /* this entry seems to match: same crc, not too old,
+ * and from another gw. therefore return 1 to forbid it.
+ */
+ return 1;
+ }
+ /* not found, add a new entry (overwrite the oldest entry) */
+ curr = (bat_priv->bcast_duplist_curr + DUPLIST_SIZE - 1) % DUPLIST_SIZE;
+ entry = &bat_priv->bcast_duplist[curr];
+ entry->crc = crc;
+ entry->entrytime = jiffies;
+ memcpy(entry->orig, bcast_packet->orig, ETH_ALEN);
+ bat_priv->bcast_duplist_curr = curr;
+
+ /* allow it, its the first occurence. */
+ return 0;
+}
+
+
+
+/**
+ * @bat_priv: the bat priv with all the soft interface information
* @orig: originator mac address
*
* check if the originator is a gateway for any VLAN ID.
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index b74940f..9468c24 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -28,6 +28,8 @@ int bla_is_backbone_gw(struct sk_buff *skb,
struct orig_node *orig_node, int hdr_size);
int bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
int bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig);
+int bla_check_bcast_duplist(struct bat_priv *bat_priv,
+ struct bcast_packet *bcast_packet, int hdr_size);
void bla_update_orig_address(struct bat_priv *bat_priv,
struct hard_iface *primary_if,
struct hard_iface *oldif);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 82723b5..d9832ac 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -83,6 +83,9 @@
#define BLA_PERIOD_LENGTH 10000 /* 10 seconds */
#define BLA_BACKBONE_TIMEOUT (BLA_PERIOD_LENGTH * 3)
#define BLA_CLAIM_TIMEOUT (BLA_PERIOD_LENGTH * 10)
+
+#define DUPLIST_SIZE 16
+#define DUPLIST_TIMEOUT 500 /* 500 ms */
/* don't reset again within 30 seconds */
#define RESET_PROTECTION_MS 30000
#define EXPECTED_SEQNO_RANGE 65536
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 1d1fd04..78eddc9 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1076,6 +1076,10 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
spin_unlock_bh(&orig_node->bcast_seqno_lock);
+ /* check whether this has been sent by another originator before */
+ if (bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
+ goto out;
+
/* rebroadcast packet */
add_bcast_packet_to_list(bat_priv, skb, 1);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 35cd831..ad97e87 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -140,6 +140,11 @@ struct neigh_node {
spinlock_t tq_lock; /* protects: tq_recv, tq_index */
};
+struct bcast_duplist_entry {
+ uint8_t orig[ETH_ALEN];
+ uint16_t crc;
+ unsigned long entrytime;
+};
struct bat_priv {
atomic_t mesh_state;
@@ -186,6 +191,8 @@ struct bat_priv {
struct list_head tt_req_list; /* list of pending tt_requests */
struct list_head tt_roam_list;
struct hashtable_t *vis_hash;
+ struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE];
+ int bcast_duplist_curr;
spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
spinlock_t forw_bcast_list_lock; /* protects */
spinlock_t tt_changes_list_lock; /* protects tt_changes */
--
1.7.9.4
^ permalink raw reply related
* [PATCH 14/16] batman-adv: drop STP over batman
From: Antonio Quartulli @ 2012-04-11 12:50 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Simon Wunderlich
In-Reply-To: <1334148649-25443-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Simon Wunderlich <simon.wunderlich-Y4E02TeZ33kaBlGTGt4zH4SGEyLTKazZ@public.gmane.org>
Signed-off-by: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/soft-interface.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 4d639b3..10ab49a 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -130,6 +130,8 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
struct hard_iface *primary_if = NULL;
struct bcast_packet *bcast_packet;
struct vlan_ethhdr *vhdr;
+ static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00,
+ 0x00};
unsigned int header_len = 0;
int data_len = skb->len, ret;
short vid = -1;
@@ -159,6 +161,12 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
/* Register the client MAC in the transtable */
tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);
+ /* don't accept stp packets. STP does not help in meshes.
+ * better use the bridge loop avoidance ...
+ */
+ if (compare_eth(ethhdr->h_dest, stp_addr))
+ goto dropped;
+
if (is_multicast_ether_addr(ethhdr->h_dest)) {
do_bcast = true;
--
1.7.9.4
^ permalink raw reply related
* [PATCH 15/16] batman-adv: form groups in the bridge loop avoidance
From: Antonio Quartulli @ 2012-04-11 12:50 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Simon Wunderlich
In-Reply-To: <1334148649-25443-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Simon Wunderlich <simon.wunderlich-Y4E02TeZ33kaBlGTGt4zH4SGEyLTKazZ@public.gmane.org>
backbone gateways may be part of the same LAN, but participate
in different meshes. With this patch, backbone gateways form groups by
applying the groupid of another backbone gateway if it is higher. After
forming the group, they only accept messages from backbone gateways of
the same group.
Signed-off-by: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bridge_loop_avoidance.c | 121 ++++++++++++++++++++++++++++++--
net/batman-adv/types.h | 1 +
2 files changed, 116 insertions(+), 6 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 4f6b44a..1cf18ac 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -33,7 +33,6 @@
#include <net/arp.h>
#include <linux/if_vlan.h>
-static const uint8_t claim_dest[6] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00};
static const uint8_t announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
static void bla_periodic_work(struct work_struct *work);
@@ -265,7 +264,8 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
if (!primary_if)
return;
- memcpy(&local_claim_dest, claim_dest, sizeof(local_claim_dest));
+ memcpy(&local_claim_dest, &bat_priv->claim_dest,
+ sizeof(local_claim_dest));
local_claim_dest.type = claimtype;
soft_iface = primary_if->soft_iface;
@@ -282,6 +282,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
primary_if->net_dev->dev_addr,
/* HW DST: FF:43:05:XX:00:00
* with XX = claim type
+ * and YY:YY = group id
*/
(uint8_t *)&local_claim_dest);
@@ -734,6 +735,86 @@ static int handle_claim(struct bat_priv *bat_priv,
/**
* @bat_priv: the bat priv with all the soft interface information
+ * @bat_priv: the bat priv with all the soft interface information
+ * @hw_src: the Hardware source in the ARP Header
+ * @hw_dst: the Hardware destination in the ARP Header
+ * @ethhdr: pointer to the Ethernet header of the claim frame
+ *
+ * checks if it is a claim packet and if its on the same group.
+ * This function also applies the group ID of the sender
+ * if it is in the same mesh.
+ *
+ * returns:
+ * 2 - if it is a claim packet and on the same group
+ * 1 - if is a claim packet from another group
+ * 0 - if it is not a claim packet
+ */
+static int check_claim_group(struct bat_priv *bat_priv,
+ struct hard_iface *primary_if,
+ uint8_t *hw_src, uint8_t *hw_dst,
+ struct ethhdr *ethhdr)
+{
+ uint8_t *backbone_addr;
+ struct orig_node *orig_node;
+ struct bla_claim_dst *bla_dst, *bla_dst_own;
+
+ bla_dst = (struct bla_claim_dst *)hw_dst;
+ bla_dst_own = &bat_priv->claim_dest;
+
+ /* check if it is a claim packet in general */
+ if (memcmp(bla_dst->magic, bla_dst_own->magic,
+ sizeof(bla_dst->magic)) != 0)
+ return 0;
+
+ /* if announcement packet, use the source,
+ * otherwise assume it is in the hw_src
+ */
+ switch (bla_dst->type) {
+ case CLAIM_TYPE_ADD:
+ backbone_addr = hw_src;
+ break;
+ case CLAIM_TYPE_REQUEST:
+ case CLAIM_TYPE_ANNOUNCE:
+ case CLAIM_TYPE_DEL:
+ backbone_addr = ethhdr->h_source;
+ break;
+ default:
+ return 0;
+ }
+
+ /* don't accept claim frames from ourselves */
+ if (compare_eth(backbone_addr, primary_if->net_dev->dev_addr))
+ return 0;
+
+ /* if its already the same group, it is fine. */
+ if (bla_dst->group == bla_dst_own->group)
+ return 2;
+
+ /* lets see if this originator is in our mesh */
+ orig_node = orig_hash_find(bat_priv, backbone_addr);
+
+ /* dont accept claims from gateways which are not in
+ * the same mesh or group.
+ */
+ if (!orig_node)
+ return 1;
+
+ /* if our mesh friends mac is bigger, use it for ourselves. */
+ if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) {
+ bat_dbg(DBG_BLA, bat_priv,
+ "taking other backbones claim group: %04x\n",
+ ntohs(bla_dst->group));
+ bla_dst_own->group = bla_dst->group;
+ }
+
+ orig_node_free_ref(orig_node);
+
+ return 2;
+}
+
+
+/**
+ * @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked
*
* Check if this is a claim frame, and process it accordingly.
@@ -753,6 +834,7 @@ static int bla_process_claim(struct bat_priv *bat_priv,
uint16_t proto;
int headlen;
short vid = -1;
+ int ret;
ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -796,8 +878,14 @@ static int bla_process_claim(struct bat_priv *bat_priv,
bla_dst = (struct bla_claim_dst *)hw_dst;
/* check if it is a claim frame. */
- if (memcmp(hw_dst, claim_dest, 3) != 0)
- return 0;
+ ret = check_claim_group(bat_priv, primary_if, hw_src, hw_dst, ethhdr);
+ if (ret == 1)
+ bat_dbg(DBG_BLA, bat_priv,
+ "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
+ ethhdr->h_source, vid, hw_src, hw_dst);
+
+ if (ret < 2)
+ return ret;
/* become a backbone gw ourselves on this vlan if not happened yet */
bla_update_own_backbone_gw(bat_priv, primary_if, vid);
@@ -944,6 +1032,10 @@ void bla_update_orig_address(struct bat_priv *bat_priv,
struct hashtable_t *hash;
int i;
+ /* reset bridge loop avoidance group id */
+ bat_priv->claim_dest.group =
+ htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN));
+
if (!oldif) {
bla_purge_claims(bat_priv, NULL, 1);
bla_purge_backbone_gw(bat_priv, 1);
@@ -1042,9 +1134,24 @@ out:
int bla_init(struct bat_priv *bat_priv)
{
int i;
+ uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00};
+ struct hard_iface *primary_if;
bat_dbg(DBG_BLA, bat_priv, "bla hash registering\n");
+ /* setting claim destination address */
+ memcpy(&bat_priv->claim_dest.magic, claim_dest, 3);
+ bat_priv->claim_dest.type = 0;
+ primary_if = primary_if_get_selected(bat_priv);
+ if (primary_if) {
+ bat_priv->claim_dest.group =
+ htons(crc16(0, primary_if->net_dev->dev_addr,
+ ETH_ALEN));
+ hardif_free_ref(primary_if);
+ } else {
+ bat_priv->claim_dest.group = 0; /* will be set later */
+ }
+
/* initialize the duplicate list */
for (i = 0; i < DUPLIST_SIZE; i++)
bat_priv->bcast_duplist[i].entrytime =
@@ -1448,8 +1555,10 @@ int bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- seq_printf(seq, "Claims announced for the mesh %s (orig %pM)\n",
- net_dev->name, primary_if->net_dev->dev_addr);
+ seq_printf(seq,
+ "Claims announced for the mesh %s (orig %pM, group id %04x)\n",
+ net_dev->name, primary_if->net_dev->dev_addr,
+ ntohs(bat_priv->claim_dest.group));
seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n",
"Client", "VID", "Originator", "CRC");
for (i = 0; i < hash->size; i++) {
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index ad97e87..7f7f610 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -193,6 +193,7 @@ struct bat_priv {
struct hashtable_t *vis_hash;
struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE];
int bcast_duplist_curr;
+ struct bla_claim_dst claim_dest;
spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
spinlock_t forw_bcast_list_lock; /* protects */
spinlock_t tt_changes_list_lock; /* protects tt_changes */
--
1.7.9.4
^ permalink raw reply related
* [PATCH 16/16] batman-adv: add bridge loop avoidance compile option
From: Antonio Quartulli @ 2012-04-11 12:50 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Simon Wunderlich
In-Reply-To: <1334148649-25443-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Simon Wunderlich <simon.wunderlich-Y4E02TeZ33kaBlGTGt4zH4SGEyLTKazZ@public.gmane.org>
The define CONFIG_BATMAN_ADV_BLA switches the bridge loop avoidance
on - skip it, and the bridge loop avoidance is not compiled in.
This is useful if binary size should be saved or the feature is
not needed.
Signed-off-by: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/Kconfig | 12 ++++++-
net/batman-adv/Makefile | 2 +-
net/batman-adv/bat_debugfs.c | 7 +++-
net/batman-adv/bat_sysfs.c | 4 +++
net/batman-adv/bridge_loop_avoidance.h | 57 ++++++++++++++++++++++++++++++++
net/batman-adv/soft-interface.c | 4 +--
net/batman-adv/types.h | 8 +++++
7 files changed, 89 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index 6ff977c..53f5244 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -4,7 +4,7 @@
config BATMAN_ADV
tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
- depends on NET && INET
+ depends on NET
select CRC16
default n
help
@@ -14,6 +14,16 @@ config BATMAN_ADV
http://www.open-mesh.org/ for more information and user space
tools.
+config BATMAN_ADV_BLA
+ bool "Bridge Loop Avoidance"
+ depends on BATMAN_ADV && INET
+ default y
+ help
+ This option enables BLA (Bridge Loop Avoidance), a mechanism
+ to avoid Ethernet frames looping when mesh nodes are connected
+ to both the same LAN and the same mesh. If you will never use
+ more than one mesh node in the same LAN, you can safely remove
+ this feature and save some space.
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile
index 94b67fd..6d5c194 100644
--- a/net/batman-adv/Makefile
+++ b/net/batman-adv/Makefile
@@ -23,7 +23,7 @@ batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o
batman-adv-y += bitarray.o
-batman-adv-y += bridge_loop_avoidance.o
+batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
batman-adv-y += gateway_client.o
batman-adv-y += gateway_common.o
batman-adv-y += hard-interface.o
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 0e35177..916380c 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -245,12 +245,13 @@ static int transtable_global_open(struct inode *inode, struct file *file)
return single_open(file, tt_global_seq_print_text, net_dev);
}
+#ifdef CONFIG_BATMAN_ADV_BLA
static int bla_claim_table_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, bla_claim_table_seq_print_text, net_dev);
}
-
+#endif
static int transtable_local_open(struct inode *inode, struct file *file)
{
@@ -285,7 +286,9 @@ static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open);
static BAT_DEBUGINFO(originators, S_IRUGO, originators_open);
static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open);
static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open);
+#ifdef CONFIG_BATMAN_ADV_BLA
static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open);
+#endif
static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open);
static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open);
@@ -293,7 +296,9 @@ static struct bat_debuginfo *mesh_debuginfos[] = {
&bat_debuginfo_originators,
&bat_debuginfo_gateways,
&bat_debuginfo_transtable_global,
+#ifdef CONFIG_BATMAN_ADV_BLA
&bat_debuginfo_bla_claim_table,
+#endif
&bat_debuginfo_transtable_local,
&bat_debuginfo_vis_data,
NULL,
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 824bfe7..c6efd68 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -386,7 +386,9 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
+#ifdef CONFIG_BATMAN_ADV_BLA
BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
+#endif
BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu);
BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
@@ -405,7 +407,9 @@ BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL);
static struct bat_attribute *mesh_attrs[] = {
&bat_attr_aggregated_ogms,
&bat_attr_bonding,
+#ifdef CONFIG_BATMAN_ADV_BLA
&bat_attr_bridge_loop_avoidance,
+#endif
&bat_attr_fragmentation,
&bat_attr_ap_isolation,
&bat_attr_vis_mode,
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 9468c24..4a8e4fc 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -22,6 +22,7 @@
#ifndef _NET_BATMAN_ADV_BLA_H_
#define _NET_BATMAN_ADV_BLA_H_
+#ifdef CONFIG_BATMAN_ADV_BLA
int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
int bla_is_backbone_gw(struct sk_buff *skb,
@@ -37,5 +38,61 @@ int bla_init(struct bat_priv *bat_priv);
void bla_free(struct bat_priv *bat_priv);
#define BLA_CRC_INIT 0
+#else /* ifdef CONFIG_BATMAN_ADV_BLA */
+
+static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb,
+ short vid)
+{
+ return 0;
+}
+
+static inline int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb,
+ short vid)
+{
+ return 0;
+}
+
+static inline int bla_is_backbone_gw(struct sk_buff *skb,
+ struct orig_node *orig_node,
+ int hdr_size)
+{
+ return 0;
+}
+
+static inline int bla_claim_table_seq_print_text(struct seq_file *seq,
+ void *offset)
+{
+ return 0;
+}
+
+static inline int bla_is_backbone_gw_orig(struct bat_priv *bat_priv,
+ uint8_t *orig)
+{
+ return 0;
+}
+
+static inline int bla_check_bcast_duplist(struct bat_priv *bat_priv,
+ struct bcast_packet *bcast_packet,
+ int hdr_size)
+{
+ return 0;
+}
+
+static inline void bla_update_orig_address(struct bat_priv *bat_priv,
+ struct hard_iface *primary_if,
+ struct hard_iface *oldif)
+{
+}
+
+static inline int bla_init(struct bat_priv *bat_priv)
+{
+ return 1;
+}
+
+static inline void bla_free(struct bat_priv *bat_priv)
+{
+}
+
+#endif /* ifdef CONFIG_BATMAN_ADV_BLA */
#endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 10ab49a..efe0fba 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -134,7 +134,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
0x00};
unsigned int header_len = 0;
int data_len = skb->len, ret;
- short vid = -1;
+ short vid __maybe_unused = -1;
bool do_bcast = false;
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
@@ -256,7 +256,7 @@ void interface_rx(struct net_device *soft_iface,
struct bat_priv *bat_priv = netdev_priv(soft_iface);
struct ethhdr *ethhdr;
struct vlan_ethhdr *vhdr;
- short vid = -1;
+ short vid __maybe_unused = -1;
/* check if enough space is available for pulling, and pull */
if (!pskb_may_pull(skb, hdr_size))
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 7f7f610..a5b1a63 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -140,11 +140,13 @@ struct neigh_node {
spinlock_t tq_lock; /* protects: tq_recv, tq_index */
};
+#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry {
uint8_t orig[ETH_ALEN];
uint16_t crc;
unsigned long entrytime;
};
+#endif
struct bat_priv {
atomic_t mesh_state;
@@ -186,14 +188,18 @@ struct bat_priv {
struct hashtable_t *orig_hash;
struct hashtable_t *tt_local_hash;
struct hashtable_t *tt_global_hash;
+#ifdef CONFIG_BATMAN_ADV_BLA
struct hashtable_t *claim_hash;
struct hashtable_t *backbone_hash;
+#endif
struct list_head tt_req_list; /* list of pending tt_requests */
struct list_head tt_roam_list;
struct hashtable_t *vis_hash;
+#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE];
int bcast_duplist_curr;
struct bla_claim_dst claim_dest;
+#endif
spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
spinlock_t forw_bcast_list_lock; /* protects */
spinlock_t tt_changes_list_lock; /* protects tt_changes */
@@ -261,6 +267,7 @@ struct tt_orig_list_entry {
struct hlist_node list;
};
+#ifdef CONFIG_BATMAN_ADV_BLA
struct backbone_gw {
uint8_t orig[ETH_ALEN];
short vid; /* used VLAN ID */
@@ -282,6 +289,7 @@ struct claim {
atomic_t refcount;
struct hlist_node hash_entry;
};
+#endif
struct tt_change_node {
struct list_head list;
--
1.7.9.4
^ permalink raw reply related
* Re: pull request: batman-adv 2012-04-11
From: Antonio Quartulli @ 2012-04-11 13:03 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1334148649-25443-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
On Wed, Apr 11, 2012 at 02:50:33 +0200, Antonio Quartulli wrote:
> Hello,
>
> this is our new set of patches (actually there has been no modification from the
> last pull request issued on 2011-04-07) which is now based on top of the current
> net-next/master branch (commit id: 06eb4eafbdc0796d741d139a44f1253278da8611).
>
> Let me know if there is something else wrong.
Sorry David,
I forgot to attach the "real" pull-request description. Here it is:
The following changes since commit 06eb4eafbdc0796d741d139a44f1253278da8611:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2012-04-10 14:30:45 -0400)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 7a5cc24277b57ce38eb0afa6634b71d4d5cc671e:
batman-adv: add bridge loop avoidance compile option (2012-04-11 14:29:00 +0200)
----------------------------------------------------------------
Included changes:
* add my name to the maintainers list of batman-adv
* some clean up fixes
* increases the default hop-penalty in order to encourage the routing protocol
to choose shorter routes
* renew the bridge loop avoidance mechanism
The latter mechanism was already present in batman-adv but recently the concept
has been discussed again and here comes the new implementation. Moreover we
added a compile option in order to let expert people, which think that this
mechanism is not helpful at all, disable it and save some space.
----------------------------------------------------------------
Antonio Quartulli (3):
MAINTAINERS: add additional maintainer for net/batman-adv
batman-adv: clean up Kconfig
batman-adv: use ETH_ALEN instead of hardcoded numeric constants
Marek Lindner (1):
batman-adv: encourage batman to take shorter routes by changing the default hop penalty
Simon Wunderlich (10):
batman-adv: remove old bridge loop avoidance code
batman-adv: add basic bridge loop avoidance code
batman-adv: make bridge loop avoidance switchable
batman-adv: export claim tables through debugfs
batman-adv: allow multiple entries in tt_global_entries
batman-adv: don't let backbone gateways exchange tt entries
batman-adv: add broadcast duplicate check
batman-adv: drop STP over batman
batman-adv: form groups in the bridge loop avoidance
batman-adv: add bridge loop avoidance compile option
Sven Eckelmann (2):
batman-adv: Replace bitarray operations with bitmap
batman-adv: Remove declaration of only locally used functions
Documentation/ABI/testing/sysfs-class-net-mesh | 9 +
Documentation/networking/batman-adv.txt | 19 +-
MAINTAINERS | 1 +
net/batman-adv/Kconfig | 27 +-
net/batman-adv/Makefile | 1 +
net/batman-adv/bat_debugfs.c | 19 +-
net/batman-adv/bat_iv_ogm.c | 15 +-
net/batman-adv/bat_sysfs.c | 8 +-
net/batman-adv/bitarray.c | 118 +-
net/batman-adv/bitarray.h | 26 +-
net/batman-adv/bridge_loop_avoidance.c | 1583 ++++++++++++++++++++++++
net/batman-adv/bridge_loop_avoidance.h | 98 ++
net/batman-adv/hard-interface.c | 18 +-
net/batman-adv/main.c | 9 +-
net/batman-adv/main.h | 11 +-
net/batman-adv/originator.c | 3 +-
net/batman-adv/packet.h | 43 +-
net/batman-adv/routing.c | 29 +-
net/batman-adv/routing.h | 1 -
net/batman-adv/soft-interface.c | 498 +-------
net/batman-adv/soft-interface.h | 2 -
net/batman-adv/translation-table.c | 435 +++++--
net/batman-adv/translation-table.h | 8 -
net/batman-adv/types.h | 77 +-
24 files changed, 2263 insertions(+), 795 deletions(-)
create mode 100644 net/batman-adv/bridge_loop_avoidance.c
create mode 100644 net/batman-adv/bridge_loop_avoidance.h
^ permalink raw reply
* Re: Fwd: build issue #1 for v3.4-rc2-23-g923e9a1 :
From: Toralf Förster @ 2012-04-11 13:12 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: davem, netdev
In-Reply-To: <1334132071.2481.13.camel@jtkirshe-mobl>
Jeff Kirsher wrote at 10:14:31
> Well I can see your config is not up to date for one thing. First I
> would try `make defconfig` OR run `make menuconfig` first. Your compile
> complains of a 3com driver which your .config has not enabled (probably
> because it is an old .config from a kernel previous to 3.2).
Right - my fault, sry.
--
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
^ permalink raw reply
* Re: [PATCH 09/26] tehuti: delete redundant NULL check before release_firmware()
From: Andy Gospodarek @ 2012-04-11 13:31 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, trivial, netdev, Andy Gospodarek
In-Reply-To: <alpine.LNX.2.00.1204092217250.13925@swampdragon.chaosbits.net>
On Mon, Apr 09, 2012 at 10:50:42PM +0200, Jesper Juhl wrote:
> release_firmware() checks for NULL pointers - no need to test before
> the call.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
> ---
> drivers/net/ethernet/tehuti/tehuti.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
> index ad973ff..a445e77 100644
> --- a/drivers/net/ethernet/tehuti/tehuti.c
> +++ b/drivers/net/ethernet/tehuti/tehuti.c
> @@ -341,8 +341,8 @@ static int bdx_fw_load(struct bdx_priv *priv)
> out:
> if (master)
> WRITE_REG(priv, regINIT_SEMAPHORE, 1);
> - if (fw)
> - release_firmware(fw);
> +
> + release_firmware(fw);
>
> if (rc) {
> netdev_err(priv->ndev, "firmware loading failed\n");
> --
> 1.7.10
>
>
> --
> Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: pull request: batman-adv 2012-04-11
From: David Miller @ 2012-04-11 13:58 UTC (permalink / raw)
To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20120411130301.GD19365-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Wed, 11 Apr 2012 15:03:03 +0200
> git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
>
> for you to fetch changes up to 7a5cc24277b57ce38eb0afa6634b71d4d5cc671e:
>
> batman-adv: add bridge loop avoidance compile option (2012-04-11 14:29:00 +0200)
Pulled, but I think the way you're doing the bridge loop avoidance stuff
is wrong.
Don't use a Kconfig option, use a sysctl to turn the behavior off or on
at runtime instead.
^ permalink raw reply
* Re: [patch net-next 1/5] team: add support for per-port options
From: David Miller @ 2012-04-11 13:58 UTC (permalink / raw)
To: jpirko; +Cc: netdev, eric.dumazet
In-Reply-To: <20120411054023.GA1955@minipsycho>
From: Jiri Pirko <jpirko@redhat.com>
Date: Wed, 11 Apr 2012 07:43:51 +0200
> Tue, Apr 10, 2012 at 08:33:56PM CEST, davem@davemloft.net wrote:
>>From: Jiri Pirko <jpirko@redhat.com>
>>Date: Tue, 10 Apr 2012 17:15:42 +0200
>>
>>> @@ -81,7 +81,16 @@ EXPORT_SYMBOL(team_port_set_team_mac);
>>> * Options handling
>>> *******************/
>>>
>>> -struct team_option *__team_find_option(struct team *team, const char *opt_name)
>>> +struct team_option_inst { /* One for each option instance */
>>> + struct list_head list;
>>> + struct team_option *option;
>>> + struct team_port *port; /* != NULL if per-port */
>>> + bool changed;
>>> + bool removed;
>>> +};
>>> +
>>
>>All this indirection... just simply embed struct team_option into
>>struct team_option_inst instead of using a pointer, and allocate a
>>full team_option_inst where you currently memdup in the options.
>
> Well the list of options is needed alone. When port is added/removed, this list
> gets iterated over and instances are created/deleted. Therefore I put
> pointer to option to option instance struct to save memory (and also to
> be nicer)
Fair enough, I'll apply this series, thanks.
^ permalink raw reply
* Re: [PATCH] net: allow pskb_expand_head() to get maximum tailroom
From: David Miller @ 2012-04-11 14:11 UTC (permalink / raw)
To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w
Cc: marc-xnduUnryOU1AfugRpC6u6w, Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ,
bhutchings-s/n/eUQHGBpZroRs9YW3xA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1334124519.5300.2246.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 11 Apr 2012 08:08:39 +0200
> Marc Merlin reported many order-1 allocations failures in TX path on its
> wireless setup, that dont make any sense with MTU=1500 network, and non
> SG capable hardware.
>
> Turns out part of the problem comes from pskb_expand_head() not using
> ksize() to get exact head size given by kmalloc(). Doing the same thing
> than __alloc_skb() allows more tailroom in skb and can prevent future
> reallocations.
>
> As a bonus, struct skb_shared_info becomes cache line aligned.
>
> Reported-by: Marc MERLIN <marc-xnduUnryOU1AfugRpC6u6w@public.gmane.org>
> Tested-by: Marc MERLIN <marc-xnduUnryOU1AfugRpC6u6w@public.gmane.org>
> Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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] tcp: avoid order-1 allocations on wifi and tx path
From: David Miller @ 2012-04-11 14:12 UTC (permalink / raw)
To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w
Cc: marc-xnduUnryOU1AfugRpC6u6w, Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ,
bhutchings-s/n/eUQHGBpZroRs9YW3xA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1334129882.5300.2539.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 11 Apr 2012 09:38:02 +0200
> David, I forgot to say this should be backported to 3.2 & 3.3
Yep.
> commit 87fb4b7b533073 (net: more accurate skb truesize) did the
> placement of skb_shared_info at the end of skb head, so
> sk_stream_alloc_skb() had to reserve more room so that tailroom stayed
> at MSS
Will keep that in mind, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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] tcp: avoid order-1 allocations on wifi and tx path
From: David Miller @ 2012-04-11 14:11 UTC (permalink / raw)
To: eric.dumazet; +Cc: marc, Larry.Finger, bhutchings, linux-wireless, netdev
In-Reply-To: <1334125848.5300.2330.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 11 Apr 2012 08:30:48 +0200
> Marc Merlin reported many order-1 allocations failures in TX path on its
> wireless setup, that dont make any sense with MTU=1500 network, and non
> SG capable hardware.
>
> After investigation, it turns out TCP uses sk_stream_alloc_skb() and
> used as a convention skb_tailroom(skb) to know how many bytes of data
> payload could be put in this skb (for non SG capable devices)
>
> Note : these skb used kmalloc-4096 (MTU=1500 + MAX_HEADER +
> sizeof(struct skb_shared_info) being above 2048)
>
> Later, mac80211 layer need to add some bytes at the tail of skb
> (IEEE80211_ENCRYPT_TAILROOM = 18 bytes) and since no more tailroom is
> available has to call pskb_expand_head() and request order-1
> allocations.
>
> This patch changes sk_stream_alloc_skb() so that only
> sk->sk_prot->max_header bytes of headroom are reserved, and use a new
> skb field, avail_size to hold the data payload limit.
>
> This way, order-0 allocations done by TCP stack can leave more than 2 KB
> of tailroom and no more allocation is performed in mac80211 layer (or
> any layer needing some tailroom)
>
> avail_size is unioned with mark/dropcount, since mark will be set later
> in IP stack for output packets. Therefore, skb size is unchanged.
>
> Reported-by: Marc MERLIN <marc@merlins.org>
> Tested-by: Marc MERLIN <marc@merlins.org>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply
* Re: pull request: batman-adv 2012-04-11
From: Antonio Quartulli @ 2012-04-11 14:31 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20120411.095809.861355939666821335.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
On Wed, Apr 11, 2012 at 09:58:09 -0400, David Miller wrote:
> From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> Date: Wed, 11 Apr 2012 15:03:03 +0200
>
> > git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
> >
> > for you to fetch changes up to 7a5cc24277b57ce38eb0afa6634b71d4d5cc671e:
> >
> > batman-adv: add bridge loop avoidance compile option (2012-04-11 14:29:00 +0200)
>
> Pulled, but I think the way you're doing the bridge loop avoidance stuff
> is wrong.
>
> Don't use a Kconfig option, use a sysctl to turn the behavior off or on
> at runtime instead.
Hello David and thank you for your feedback.
Actually we have either the Kconfig option (for binary size purposes) AND a
boolean attribute in our soft_interface sysfs path (to dynamically turn the
bridge loop avoidance ON and OFF as you were suggesting).
Regards,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [net-next PATCH v1 7/7] macvlan: add FDB bridge ops and new macvlan mode
From: John Fastabend @ 2012-04-11 14:32 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Sridhar Samudrala, roprabhu, stephen.hemminger, davem, hadi,
bhutchings, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120411080239.GB8562@redhat.com>
On 4/11/2012 1:02 AM, Michael S. Tsirkin wrote:
> On Tue, Apr 10, 2012 at 06:42:47PM -0700, John Fastabend wrote:
>> On 4/10/2012 5:46 PM, Sridhar Samudrala wrote:
>>> On 4/10/2012 8:35 AM, John Fastabend wrote:
>>>> On 4/10/2012 8:30 AM, Michael S. Tsirkin wrote:
>>>>> On Tue, Apr 10, 2012 at 08:26:21AM -0700, John Fastabend wrote:
>>>>>> On 4/10/2012 7:35 AM, Michael S. Tsirkin wrote:
>>>>>>> On Tue, Apr 10, 2012 at 07:25:58AM -0700, John Fastabend wrote:
>>>>>>>>> Hmm okay, but this would mean we should convert
>>>>>>>>> MACVLAN_MODE_PASSTHRU_NOPROMISC to something
>>>>>>>>> that can combined with all modes. E.g.
>>>>>>>>> MACVLAN_MODE_BRIDGE | MACVLAN_MODE_FLAG_XXXXX
>>>>>>>>>
>>>>>>>>> and document that it does not promise to flood
>>>>>>>>> multicast.
>>>>>>>>>
>>>>>>>> How about changing MACVLAN_MODE_PASSTHRU_NOPROMISC -> MACVLAN_MODE_NOPORMISC
>>>>>>>> for this patch. Then a follow on series can rework bridge
>>>>>>>> and VEPA to use it as well.
>>>>>>> Right. We probably need a better name if it's going to
>>>>>>> affect other things besides promisc though.
>>>>>>>
>>>>>> how about MACVLAN_MODE_FDBFLAG?
>>>>> The idea being that no one figures out what this means so
>>>>> no one will make any wrong assumptions? ;)
>>>>>
>>>> Well its a flag to enable the FDB (forwarding database) ops
>>>> and skip dev_set_promisc() on passthru mode. Any better ideas?
>>>> Maybe MACVLAN_MODE_FDBENABLE or MACVLAN_MODE_MANAGE_FDB?
>>> Do we need to introduce another mode? I think this patch is enabling passthru mode without the need
>>> to put the underlying device in promiscuous mode. So basically we can consider this patch as
>>> an optimization.
>>>
>>> Thanks
>>> Sridhar
>>>
>>
>> Sridhar, Michael,
>>
>> After thinking about this a bit I would propose keeping this
>> patch as is. Or if we prefer I can make this a flag but I don't
>> think that helps much. passthru mode is the only macvlan mode
>> that calls dev_set_promiscuity(). Either way I think this mode
>> or flag should _only_ toggle the call to dev_set_promiscuity().
>>
>> Setting multicast dev->flag IFF_ALLMULTI seems to be a completely
>> separate optimization that we can work with a follow up patch.
>>
>> Any thoughts?
>>
>> Thanks for the feedback,
>> John
>
> I agree it's a separate optimization. But if we let the
> number of supported modes explode
> (MACVLAN_MODE_PASSTHRU_NOPROMISC MACVLAN_MODE_PASSTHRU_NOALLMULTI
> ....) supporting them all and combinations thereof might become a problem.
>
> I'm looking for an interface solution that will limit this
> overhead without breaking existing setups.
>
I'm going to respin this series today. I'll try to rework this with
a flags field so that we can set nopromisc and noallmutli using flags
and not have the supported mode space explode.
>
> One idea was to have a flag that says basically "really obey device
> configuration". Yes if we do this we can then split the support to
> multiple patches and consider each individual one a bugfix, though if we
> put a known broken solution in 3.5 there's a danger that someone will
> come to depend on the broken behaviour. Other ideas?
>
>
This sound reasonable.
Thanks,
John
^ permalink raw reply
* Re: [B.A.T.M.A.N.] pull request: batman-adv 2012-04-11
From: David Miller @ 2012-04-11 14:39 UTC (permalink / raw)
To: ordex; +Cc: netdev, b.a.t.m.a.n
In-Reply-To: <20120411143102.GE19365@ritirata.org>
From: Antonio Quartulli <ordex@autistici.org>
Date: Wed, 11 Apr 2012 16:31:03 +0200
> Actually we have either the Kconfig option (for binary size purposes) AND a
> boolean attribute in our soft_interface sysfs path (to dynamically turn the
> bridge loop avoidance ON and OFF as you were suggesting).
Distributions are just going to turn on everything, so for %99.999 of
users you really aren't saving anything.
^ permalink raw reply
* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Arvid Brodin @ 2012-04-11 14:39 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Ben Hutchings, David Miller, netdev@vger.kernel.org,
balferreira@googlemail.com
In-Reply-To: <20120410182847.45e47c5e@nehalam.linuxnetplumber.net>
On 2012-04-11 03:28, Stephen Hemminger wrote:
>
>> 3) My feeble suggestion to cast icmp_hdr() to (char *) is of course even worse (it doesn't
>> even avoid the erroneous cast in the first place).
>>
>> So what do we do?
>>
>
> Reading Documentation/unalgined-memory-access.txt suggests that you
> probably should copy the skb before passing up the stack (if necessary).
> That is safe (but slightly slower).
Ok, so my patch does the right thing then? I.e. if no HAVE_EFFICIENT_UNALIGNED_ACCESS and
the user does not choose to pad the HSR tag (with NONSTANDARD_HSR), we memmove the payload
(look in hsr_rcv()).
Or do you want me to remove the option to pad the HSR tag to get rid of the memmove if we
don't HAVE_EFFICIENT_UNALIGNED_ACCESS?
--
Arvid Brodin
Enea Services Stockholm AB - since February 16 a part of Xdin in the Alten Group. Soon we
will be working under the common brand name Xdin. Read more at www.xdin.com.
^ permalink raw reply
* Re: pull request: batman-adv 2012-04-11
From: Gioacchino Mazzurco @ 2012-04-11 14:43 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Miller
In-Reply-To: <20120411.103933.846397076858317541.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
It is not like that for a lot of batman-adv users that works with
embedded devices where even 10KB makes the dfference
On 04/11/12 16:39, David Miller wrote:
> From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> Date: Wed, 11 Apr 2012 16:31:03 +0200
>
>> Actually we have either the Kconfig option (for binary size purposes) AND a
>> boolean attribute in our soft_interface sysfs path (to dynamically turn the
>> bridge loop avoidance ON and OFF as you were suggesting).
>
> Distributions are just going to turn on everything, so for %99.999 of
> users you really aren't saving anything.
^ permalink raw reply
* Re: [net-next PATCH v1 1/7] net: add generic PF_BRIDGE:RTM_ FDB hooks
From: John Fastabend @ 2012-04-11 14:45 UTC (permalink / raw)
To: Ben Hutchings
Cc: roprabhu, mst, stephen.hemminger, davem, hadi, jeffrey.t.kirsher,
netdev, gregory.v.rose, krkumar2, sri
In-Reply-To: <1334114599.7150.361.camel@deadeye>
On 4/10/2012 8:23 PM, Ben Hutchings wrote:
> On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
> [...]
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 1f77540..05822e5 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
> [...]
>> @@ -905,6 +906,19 @@ struct netdev_fcoe_hbainfo {
>> * feature set might be less than what was returned by ndo_fix_features()).
>> * Must return >0 or -errno if it changed dev->features itself.
>> *
>> + * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
>> + * unsigned char *addr, u16 flags)
>> + * Adds an FDB entry to dev for addr. The ndmsg contains flags to indicate
>> + * if the dev->master FDB should be updated or the devices internal FDB.
>
> I don't think the second sentence is helpful, as rtnl_fdb_add() will
> take care of those flags.
>
>> + * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
>> + * unsigned char *addr)
>> + * Deletes the FDB entry from dev coresponding to addr. The ndmsg
>> + * contains flags to indicate if the dev->master FDB should be
>> + * updated or the devices internal FDB.
>
> Similarly here.
agreed neither seem particularly helpful I'll remove them.
>
>> + * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
>> + * struct net_device *dev, int idx)
>> + * Used to add FDB entries to dump requests. Implementers should add
>> + * entries to skb and update idx with the number of entries.
>> */
> [...
>> --- a/net/core/rtnetlink.c
>> +++ b/net/core/rtnetlink.c
> [...]
>> +static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
>> +{
> [...]
>> + err = -EOPNOTSUPP;
>
> So if NTF_MASTER and NTF_SELF are both set, we can quietly fall back to
> just setting one FDB? Not sure that's really desirable though
>
It makes it easier to keep an embedded agent and the sw bridge in
sync if setting both flags adds the entry to both the SW bridge and
embedded bridge. But the error case gets a bit tricky as your comments
below indicate.
>> + /* Support fdb on master device the net/bridge default case */
>> + if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
>> + (dev->priv_flags & IFF_BRIDGE_PORT)) {
>> + struct net_device *master = dev->master;
>> +
>> + if (master->netdev_ops->ndo_fdb_add)
>
> This operation is surely going to be mandatory for bridge devices, so
> this check should be omitted or changed to a BUG_ON().
I'll just remove the check.
>
>> + err = master->netdev_ops->ndo_fdb_add(ndm, dev, addr,
>> + nlh->nlmsg_flags);
>
> Shoudn't we return early on error?
Agreed better to return an err here.
>
>> + }
>> +
>> + /* Embedded bridge, macvlan, and any other device support */
>> + if ((ndm->ndm_flags & NTF_SELF) &&
>> + dev->netdev_ops->ndo_fdb_add)
>
> Error if !dev->netdev_ops->ndo_fdb_add.
>
>> + err = dev->netdev_ops->ndo_fdb_add(ndm, dev, addr,
>> + nlh->nlmsg_flags);
>
> Wonder what we should do on error here if we've already successfully
> called ndo_fdb_add on the master? Should we try to roll back the first
> addition?
>
The problem with rolling back is the table is likely already updated and
traffic may already be being forwarded. So I think in this case the user
will have to query the device to learn what failed. It seems like the
simplest way to handle this. I think it is unwanted to have traffic being
forwarded one way for a short period of time then rolled back.
The other idea I just had is we could clear the NTF_ bit in ndm_flags after
the successful add, del command. I believe the nlmsg gets sent back to the
user on error I would need to check on this.
>> + return err;
>> +}
>> +
>> +static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
>> +{
> [...]
>> + err = -EOPNOTSUPP;
>> +
>> + /* Support fdb on master device the net/bridge default case */
>> + if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
>> + (dev->priv_flags & IFF_BRIDGE_PORT)) {
>> + struct net_device *master = dev->master;
>> +
>> + if (master->netdev_ops->ndo_fdb_del)
>> + err = master->netdev_ops->ndo_fdb_del(ndm, dev, addr);
>> + }
>> +
>> + /* Embedded bridge, macvlan, and any other device support */
>> + if ((ndm->ndm_flags & NTF_SELF) &&
>> + dev->netdev_ops->ndo_fdb_del)
>> + err = dev->netdev_ops->ndo_fdb_del(ndm, dev, addr);
>> + return err;
>> +}
> [...]
>
> This has the same issues.
>
same comment as above
> Ben.
>
^ permalink raw reply
* Re: [net-next PATCH v1 2/7] net: addr_list: add exclusive dev_uc_add and dev_mc_add
From: John Fastabend @ 2012-04-11 14:46 UTC (permalink / raw)
To: Ben Hutchings
Cc: mst, stephen.hemminger, davem, hadi, jeffrey.t.kirsher, netdev,
gregory.v.rose, krkumar2, sri
In-Reply-To: <1334115190.7150.365.camel@deadeye>
On 4/10/2012 8:33 PM, Ben Hutchings wrote:
> On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
>> This adds a dev_uc_add_excl() and dev_mc_add_excl() calls
>> similar to the original dev_{uc|mc}_add() except it sets
>> the global bit and returns -EEXIST for duplicat entires.
>>
>> This is useful for drivers that support SR-IOV, macvlan
>> devices and any other devices that need to manage the
>> unicast and multicast lists.
> [...]
>> +/**
>> + * dev_mc_add_excl - Add a global secondary multicast address
>> + * @dev: device
>> + * @addr: address to add
>> + */
>> +int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
>> +{
>> + struct netdev_hw_addr *ha;
>> + int err;
>> +
>> + netif_addr_lock_bh(dev);
>> + list_for_each_entry(ha, &dev->mc.list, list) {
>> + if (!memcmp(ha->addr, addr, dev->addr_len) &&
>> + ha->type == NETDEV_HW_ADDR_T_UNICAST) {
>> + err = -EEXIST;
>> + goto out;
>> + }
>> + }
>> + err = __hw_addr_create_ex(&dev->mc, addr, dev->addr_len,
>> + NETDEV_HW_ADDR_T_UNICAST, true);
> [...]
>
> The address types are wrong. But do we even need this function yet?
>
> Ben.
>
macvlan wants to manage multicast addresses as well. Good catch thanks.
.John
^ permalink raw reply
* Re: [net-next PATCH v1 3/7] net: add fdb generic dump routine
From: John Fastabend @ 2012-04-11 14:46 UTC (permalink / raw)
To: Ben Hutchings
Cc: mst, stephen.hemminger, davem, hadi, jeffrey.t.kirsher, netdev,
gregory.v.rose, krkumar2, sri
In-Reply-To: <1334115901.7150.371.camel@deadeye>
On 4/10/2012 8:45 PM, Ben Hutchings wrote:
> On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
>> This adds a generic dump routine drivers can call. It
>> should be sufficient to handle any bridging model that
>> uses the unicast address list. This should be most SR-IOV
>> enabled NICs.
> [...]
>> +static int nlmsg_populate_fdb(struct sk_buff *skb,
>> + struct netlink_callback *cb,
>> + struct net_device *dev,
>> + int *idx,
>> + struct netdev_hw_addr_list *list)
>> +{
>> + struct netdev_hw_addr *ha;
>> + struct ndmsg *ndm;
>> + struct nlmsghdr *nlh;
>> + u32 pid, seq;
>> +
>> + pid = NETLINK_CB(cb->skb).pid;
>> + seq = cb->nlh->nlmsg_seq;
>> +
>> + list_for_each_entry(ha, &list->list, list) {
>> + if (*idx < cb->args[0])
>> + goto skip;
>> +
>> + nlh = nlmsg_put(skb, pid, seq,
>> + RTM_NEWNEIGH, sizeof(*ndm), NLM_F_MULTI);
>> + if (!nlh)
>> + break;
>
> This break is effectively return 0, but shouldn't we return an error?
> In practice this does no harm because any subsequent invocation of
> nlmsg_populate_fdb() for the same skb is also going to fail here with no
> change to *idx. But it would be more obviously correct to return an
> error.
>
sure returning -EMSGSIZE seems to be inline with rtnl_fill_ifinfo and
easier to read.
> [...]
>> + }
>> + return 0;
>> +nla_put_failure:
>> + nlmsg_cancel(skb, nlh);
>> + return -ENOMEM;
>> +}
> [...]
>
also might be better to return -EMSGSIZE here as well. It seems to be
more inline with convention.
.John
^ permalink raw reply
* Re: pull request: batman-adv 2012-04-11
From: David Miller @ 2012-04-11 14:50 UTC (permalink / raw)
To: gmazzurco89-Re5JQEeQqe8AvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <4F85989F.6030802-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Gioacchino Mazzurco <gmazzurco89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 11 Apr 2012 16:43:43 +0200
> It is not like that for a lot of batman-adv users that works with
> embedded devices where even 10KB makes the dfference
Ok, but you also have the option of making it a seperate module
too.
Right now it's an all or nothing choice. Once you make a Kconfig
decision, later it's harder to rebuild the kernel to fix a mistake
than to simply load the module in question.
^ permalink raw reply
* Re: suspicious RCU usage warnings in 3.3.0
From: Meelis Roos @ 2012-04-11 15:08 UTC (permalink / raw)
To: David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <20120328.174559.650861844028495880.davem@davemloft.net>
> > Is this the same RCU problem that was fixed after 3.3 (fix a potential
> > rcu_read_lock() imbalance in rt6_fill_node())? My problem does not seem
> > to be ipv6-only, most traces are from IPv6 but some for ip.
>
> It's hard to say because the ipv6 RCU problem causes the warning to
> trigger somewhere away from the ipv6 code that had the RCU locking
> bug.
Tested todays 3.4.0-rc2-00016-ga9e1e53 on the same with flood ping and
still got RCU warning:
[36456.693191]
[36456.712658] ===============================
[36456.767614] [ INFO: suspicious RCU usage. ]
[36456.822588] 3.4.0-rc2-00016-ga9e1e53 #36 Not tainted
[36456.887835] -------------------------------
[36456.942804] include/linux/netpoll.h:70 suspicious rcu_dereference_check() usage!
[36457.040083]
[36457.040089] other info that might help us debug this:
[36457.040098]
[36457.145306]
[36457.145312] RCU used illegally from idle CPU!
[36457.145320] rcu_scheduler_active = 1, debug_locks = 0
[36457.288293] RCU used illegally from extended quiescent state!
[36457.363834] no locks held by swapper/0.
[36457.414221]
[36457.414227] stack backtrace:
[36457.471471] Call Trace:
[36457.503600] [0000000000489834] lockdep_rcu_suspicious+0xd4/0x100
[36457.583727] [00000000006755a8] __netif_receive_skb+0x368/0xa80
[36457.661536] [0000000000675e6c] netif_receive_skb+0x4c/0x60
[36457.734787] [000000000063fd74] tulip_poll+0x3b4/0x6a0
[36457.802327] [00000000006794d8] net_rx_action+0x118/0x1e0
[36457.873299] [00000000004560fc] __do_softirq+0x9c/0x140
[36457.941984] [000000000042b1c4] do_softirq+0x84/0xc0
[36458.007229] [0000000000404a40] __handle_softirq+0x0/0x10
[36458.078199] [000000000042b688] cpu_idle+0x48/0x100
[36458.142314] [0000000000722db8] rest_init+0x160/0x188
[36458.208711] [00000000008c87b0] start_kernel+0x32c/0x33c
[36458.278530] [0000000000722c50] tlb_fixup_done+0x88/0x90
[36458.348346] [0000000000000000] (null)
--
Meelis Roos (mroos@linux.ee)
^ permalink raw reply
* [RFC] net/bridge: port based vlan filtering for bridges
From: Benjamin LaHaise @ 2012-04-11 15:10 UTC (permalink / raw)
To: netdev
Hello folks,
Attached is the first stab at a patch to make it possible to filter packets
received from other bridge ports based on the port number. This can be used
to emulate port based VLANs that some switches support.
The justification for this is a bit interesting. Initially, I had been
filtering packets using firewall rules. Unfortunately, the number of
filter rules becomes impossible to manage when trying to filter traffic
between 100 different ports. CPU overhead of the filters is also a major
problem.
The particular use-case I'm dealing with is simulating wireless networks
on a system using LXC containers. Each guest has a veth device that is a
member of the bridge, but the topology of which nodes can "hear" each other
changes at runtime.
Comments/thoughts?
-ben
---
br_forward.c | 3 +++
br_if.c | 3 +--
br_private.h | 4 ++++
br_sysfs_if.c | 20 ++++++++++++++++++++
4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index ee64287..9b106f8 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -30,6 +30,9 @@ static int deliver_clone(const struct net_bridge_port *prev,
static inline int should_deliver(const struct net_bridge_port *p,
const struct sk_buff *skb)
{
+ struct net_bridge_port *from = br_port_get_rcu(skb->dev);
+ if (from && test_bit(from->port_no, p->filter_ports))
+ return 0;
return (((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
p->state == BR_STATE_FORWARDING);
}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f603e5b..2f2e595 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -183,8 +183,7 @@ static int find_portno(struct net_bridge *br)
struct net_bridge_port *p;
unsigned long *inuse;
- inuse = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
- GFP_KERNEL);
+ inuse = kcalloc(BR_PORT_LONGS, sizeof(unsigned long), GFP_KERNEL);
if (!inuse)
return -ENOMEM;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index d7d6fb0..c6fbab0 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -17,6 +17,7 @@
#include <linux/if_bridge.h>
#include <linux/netpoll.h>
#include <linux/u64_stats_sync.h>
+#include <linux/bitops.h>
#include <net/route.h>
#define BR_HASH_BITS 8
@@ -26,6 +27,7 @@
#define BR_PORT_BITS 10
#define BR_MAX_PORTS (1<<BR_PORT_BITS)
+#define BR_PORT_LONGS BITS_TO_LONGS(BR_MAX_PORTS)
#define BR_VERSION "2.3"
@@ -156,6 +158,8 @@ struct net_bridge_port
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *np;
#endif
+
+ unsigned long filter_ports[BR_PORT_LONGS];
};
#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 6229b62..9d95f6a 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -164,6 +164,24 @@ static BRPORT_ATTR(multicast_router, S_IRUGO | S_IWUSR, show_multicast_router,
store_multicast_router);
#endif
+static int store_add_filter_port(struct net_bridge_port *p, unsigned long v)
+{
+ if (v >= BR_MAX_PORTS)
+ return -EINVAL;
+ set_bit(v, p->filter_ports);
+ return 0;
+}
+static BRPORT_ATTR(add_filter_port, S_IWUSR, NULL, store_add_filter_port);
+
+static int store_remove_filter_port(struct net_bridge_port *p, unsigned long v)
+{
+ if (v >= BR_MAX_PORTS)
+ return -EINVAL;
+ clear_bit(v, p->filter_ports);
+ return 0;
+}
+static BRPORT_ATTR(remove_filter_port, S_IWUSR, NULL, store_remove_filter_port);
+
static struct brport_attribute *brport_attrs[] = {
&brport_attr_path_cost,
&brport_attr_priority,
@@ -184,6 +202,8 @@ static struct brport_attribute *brport_attrs[] = {
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
&brport_attr_multicast_router,
#endif
+ &brport_attr_add_filter_port,
+ &brport_attr_remove_filter_port,
NULL
};
--
"Thought is the essence of where you are now."
^ permalink raw reply related
* Re: [PATCH net-next] rtnetlink & bonding: change args got get_tx_queues
From: Stephen Hemminger @ 2012-04-11 15:20 UTC (permalink / raw)
To: Eric Dumazet
Cc: Ben Hutchings, Jay Vosburgh, Andy Gospodarek, David Miller,
netdev
In-Reply-To: <1334123747.5300.2197.camel@edumazet-glaptop>
On Wed, 11 Apr 2012 07:55:47 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2012-04-10 at 21:34 -0700, Stephen Hemminger wrote:
> > Change get_tx_queues, drop unsused arg/return value real_tx_queues,
> > and use return by value (with error) rather than call by reference.
> >
> > Probably bonding should just change to LLTX and the whole get_tx_queues
> > API could disappear!
>
> Absolutely ;)
>
>
It is more complex than that (actually the bonding driver is a mess).
The bonding device is already using Lockless Transmit and transmit queue length
of zero (good), but it then does some queue mapping of it's own which
is unnecessary.
Multiqueue only makes sense if there is a queue, otherwise the skb
can transparently pass through the layered device (vlan, bridge, bond)
and get queued on the real physical device.
Right now, trying to see if there is any impact by just leaving
bond device as single queue.
^ permalink raw reply
* ipv6 multicast listener on linux box acting as multicast router
From: Massimiliano D'Angelo @ 2012-04-11 15:24 UTC (permalink / raw)
To: netdev
Hi guys,
I would like to have your opinion on a comment in the ip6mr.c file
(kernel 2.6.29.4). The comment follows:
/*
* RFC1584 teaches, that DVMRP/PIM router must deliver packets locally
* not only before forwarding, but after forwarding on all output
* interfaces. It is clear, if mrouter runs a multicasting
* program, it should receive packets not depending to what interface
* program is joined.
* If we will not make it, the program will have to join on all
* interfaces. On the other hand, multihoming host (or router, but
* not mrouter) cannot join to more than one interface - it will
* result in receiving multiple packets.
*/
Does the part "if we will not make it..." mean that such behaviour is
not yet implemented in the kernel? Looking at the code, it seems to me
that it is not yet implemented, but I would like someone to confirm
it.
As an implication, if I have a IPv6 multicast listener on a Linux box
acting as multicast router, do I need to have my application listening
on all the interfaces if I want to receive the multicast messages no
matter what is the interface from which they are received?
Thanks in advance for your help!
Massimiliano
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox