From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Split the setting for number re-broadcasts
Date: Wed, 30 Mar 2016 14:19:31 +0200 [thread overview]
Message-ID: <1459340372-6971-1-git-send-email-sven@narfation.org> (raw)
The number of rebroadcasts are currently not differenciated between
re-broadcasts on the same interface and the re-broadcasts on a different
interface. This differenciation can be important when the link medium
already guarantees to some extend that a packet received by one participant
is also received by all other participants.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
net/batman-adv/hard-interface.c | 10 +++++++---
net/batman-adv/main.h | 3 ++-
net/batman-adv/send.c | 8 +++++++-
net/batman-adv/types.h | 8 ++++++--
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f41b472..a8385fa 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -678,9 +678,13 @@ batadv_hardif_add_interface(struct net_device *net_dev)
spin_lock_init(&hard_iface->neigh_list_lock);
- hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
- if (batadv_is_wifi_netdev(net_dev))
- hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
+ if (batadv_is_wifi_netdev(net_dev)) {
+ hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_WIRELESS;
+ hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_WIRELESS;
+ } else {
+ hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_SAMEIF;
+ hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_OTHERIF;
+ }
/* extra reference for return */
kref_init(&hard_iface->refcount);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 1565df0..aad4a3a 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -96,7 +96,8 @@
#define BATADV_LOG_BUF_LEN 8192 /* has to be a power of 2 */
/* number of packets to send for broadcasts on different interface types */
-#define BATADV_NUM_BCASTS_DEFAULT 1
+#define BATADV_NUM_BCASTS_SAMEIF 1
+#define BATADV_NUM_BCASTS_OTHERIF 1
#define BATADV_NUM_BCASTS_WIRELESS 3
#define BATADV_NUM_BCASTS_MAX 3
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 2e8433b..724bd6e 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -552,6 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
struct sk_buff *skb1;
struct net_device *soft_iface;
struct batadv_priv *bat_priv;
+ u8 num_bcasts;
delayed_work = to_delayed_work(work);
forw_packet = container_of(delayed_work, struct batadv_forw_packet,
@@ -575,7 +576,12 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
if (hard_iface->soft_iface != soft_iface)
continue;
- if (forw_packet->num_packets >= hard_iface->num_bcasts)
+ if (forw_packet->skb->dev == hard_iface->net_dev)
+ num_bcasts = hard_iface->num_bcasts_sameif;
+ else
+ num_bcasts = hard_iface->num_bcasts_otherif;
+
+ if (forw_packet->num_packets >= num_bcasts)
continue;
if (!kref_get_unless_zero(&hard_iface->refcount))
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9abfb3e..5e80113 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -122,7 +122,10 @@ struct batadv_hard_iface_bat_v {
* @if_num: identificator of the interface
* @if_status: status of the interface for batman-adv
* @net_dev: pointer to the net_device
- * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
+ * @num_bcasts_sameif: number of payload re-broadcasts on this interface (ARQ)
+ * when the packet was received on this interface
+ * @num_bcasts_otherif: number of payload re-broadcasts on this interface (ARQ)
+ * when the packet was received on a different interface
* @hardif_obj: kobject of the per interface sysfs "mesh" directory
* @refcount: number of contexts the object is used
* @batman_adv_ptype: packet type describing packets that should be processed by
@@ -141,7 +144,8 @@ struct batadv_hard_iface {
s16 if_num;
char if_status;
struct net_device *net_dev;
- u8 num_bcasts;
+ u8 num_bcasts_sameif;
+ u8 num_bcasts_otherif;
struct kobject *hardif_obj;
struct kref refcount;
struct packet_type batman_adv_ptype;
--
2.8.0.rc3
next reply other threads:[~2016-03-30 12:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 12:19 Sven Eckelmann [this message]
2016-03-30 12:19 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices Sven Eckelmann
2016-03-31 8:41 ` Matthias Schiffer
2016-03-31 9:07 ` Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459340372-6971-1-git-send-email-sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox