pull request for net-next: batman-adv 2019-08-08
Subsystems (3)
Simon Wunderlich
maintainercover pull request for net-next: batman-adv 2019-08-08
Hi David,
here is a small feature/cleanup pull request of batman-adv to go into net-next.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b:
Linus 5.3-rc1 (2019-07-21 14:05:38 -0700)
are available in the Git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20190808
for you to fetch changes up to 9cb9a17813bf0de1f8ad6deb9538296d5148b5a8:
batman-adv: BATMAN_V: aggregate OGMv2 packets (2019-08-04 22:22:00 +0200)
----------------------------------------------------------------
This feature/cleanup patchset includes the following patches:
- bump version strings, by Simon Wunderlich
- Replace usage of strlcpy with strscpy, by Sven Eckelmann
- Add OGMv2 per-interface queue and aggregations, by Linus Luessing (2 patches)
----------------------------------------------------------------
Linus Lüssing (2):
batman-adv: BATMAN_V: introduce per hard-iface OGMv2 queues
batman-adv: BATMAN_V: aggregate OGMv2 packets
Simon Wunderlich (1):
batman-adv: Start new development cycle
Sven Eckelmann (1):
batman-adv: Replace usage of strlcpy with strscpy
net/batman-adv/bat_v.c | 7 ++ net/batman-adv/bat_v_ogm.c | 179 +++++++++++++++++++++++++++++++++++++++- net/batman-adv/bat_v_ogm.h | 3 + net/batman-adv/main.h | 2 +- net/batman-adv/soft-interface.c | 8 +- net/batman-adv/sysfs.c | 2 +- net/batman-adv/types.h | 12 +++ 7 files changed, 205 insertions(+), 8 deletions(-)
Simon Wunderlich
maintainerPATCH 1/4 batman-adv: Start new development cycle
--- net/batman-adv/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
@@ -13,7 +13,7 @@#define BATADV_DRIVER_DEVICE "batman-adv"#ifndef BATADV_SOURCE_VERSION -#define BATADV_SOURCE_VERSION "2019.3" +#define BATADV_SOURCE_VERSION "2019.4"#endif /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.20.1
Simon Wunderlich
maintainerPATCH 2/4 batman-adv: Replace usage of strlcpy with strscpy
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
The strscpy was introduced to fix some API problems around strlcpy. And checkpatch started to report recently that strlcpy is deprecated and strscpy is preferred.
The functionality introduced in commit 30035e45753b ("string: provide strscpy()") improves following points compared to strlcpy:
* it doesn't read from memory beyond (src + size)
* provides an easy way to check for destination buffer overflow
* robust against asynchronous source buffer changes
Since batman-adv doesn't depend on any of the previously mentioned behavior changes, the usage of strlcpy can simply be replaced by strscpy to silence checkpatch.
--- net/batman-adv/soft-interface.c | 8 ++++---- net/batman-adv/sysfs.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
net/batman-adv/soft-interface.c +4 -4
@@ -943,10 +943,10 @@ static const struct net_device_ops batadv_netdev_ops = {static void batadv_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) { -strlcpy (info->driver,"B.A.T.M.A.N. advanced" ,sizeof (info->driver)); -strlcpy (info->version,BATADV_SOURCE_VERSION ,sizeof (info->version)); -strlcpy (info->fw_version,"N/A" ,sizeof (info->fw_version)); -strlcpy (info->bus_info,"batman" ,sizeof (info->bus_info)); +strscpy (info->driver,"B.A.T.M.A.N. advanced" ,sizeof (info->driver)); +strscpy (info->version,BATADV_SOURCE_VERSION ,sizeof (info->version)); +strscpy (info->fw_version,"N/A" ,sizeof (info->fw_version)); +strscpy (info->bus_info,"batman" ,sizeof (info->bus_info)); }/* Inspired by drivers/net/ethernet/dlink/sundance.c:1702
net/batman-adv/sysfs.c +1 -1
@@ -1070,7 +1070,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,dev_hold (net_dev);INIT_WORK (&store_work->work, batadv_store_mesh_iface_work); store_work->net_dev = net_dev; -strlcpy (store_work->soft_iface_name, buff, +strscpy (store_work->soft_iface_name, buff,sizeof (store_work->soft_iface_name));queue_work (batadv_event_workqueue, &store_work->work);
Signature · 1 line
2.20.1
Simon Wunderlich
maintainerPATCH 3/4 batman-adv: BATMAN_V: introduce per hard-iface OGMv2 queues
In reply to Simon WunderlichFrom: Linus Lüssing <[email protected]>
In preparation for the OGMv2 packet aggregation, hold OGMv2 packets for up to BATADV_MAX_AGGREGATION_MS milliseconds (100ms) on per hard-interface queues, before transmitting.
This allows us to later squash multiple OGMs into a single frame and transmission for reduced overhead.
--- net/batman-adv/bat_v.c | 7 ++ net/batman-adv/bat_v_ogm.c | 153 ++++++++++++++++++++++++++++++++++++- net/batman-adv/bat_v_ogm.h | 3 + net/batman-adv/types.h | 12 +++ 4 files changed, 173 insertions(+), 2 deletions(-)
net/batman-adv/bat_v.c +7 -0
@@ -79,6 +79,7 @@ static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)static void batadv_v_iface_disable (struct batadv_hard_iface *hard_iface) { +batadv_v_ogm_iface_disable (hard_iface);batadv_v_elp_iface_disable (hard_iface); }
@@ -1081,6 +1082,12 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface)*/ atomic_set (&hard_iface->bat_v.throughput_override,0 );atomic_set (&hard_iface->bat_v.elp_interval,500 ); + + hard_iface->bat_v.aggr_len =0 ; +skb_queue_head_init (&hard_iface->bat_v.aggr_list); +spin_lock_init (&hard_iface->bat_v.aggr_list_lock); +INIT_DELAYED_WORK (&hard_iface->bat_v.aggr_wq, + batadv_v_ogm_aggr_work); }/**
net/batman-adv/bat_v_ogm.c +151 -2
206 lines not on this page · raw message
net/batman-adv/bat_v_ogm.h +3 -0
@@ -11,10 +11,13 @@#include <linux/skbuff.h> #include <linux/types.h> +#include <linux/workqueue.h> int batadv_v_ogm_init (struct batadv_priv *bat_priv);void batadv_v_ogm_free (struct batadv_priv *bat_priv); +void batadv_v_ogm_aggr_work (struct work_struct *work);int batadv_v_ogm_iface_enable (struct batadv_hard_iface *hard_iface); +void batadv_v_ogm_iface_disable (struct batadv_hard_iface *hard_iface);struct batadv_orig_node *batadv_v_ogm_orig_get (struct batadv_priv *bat_priv,const u8 *addr);void batadv_v_ogm_primary_iface_set (struct batadv_hard_iface *primary_iface);
net/batman-adv/types.h +12 -0
@@ -117,6 +117,18 @@ struct batadv_hard_iface_bat_v {/** @elp_wq: workqueue used to schedule ELP transmissions */ struct delayed_work elp_wq; +/** @aggr_wq: workqueue used to transmit queued OGM packets */ +struct delayed_work aggr_wq; + +/** @aggr_list: queue for to be aggregated OGM packets */ +struct sk_buff_head aggr_list; + +/** @aggr_len: size of the OGM aggregate (excluding ethernet header) */ +unsigned int aggr_len; + +/** @aggr_list_lock: protects aggr_list */ +spinlock_t aggr_list_lock; +/** * @throughput_override: throughput override to disable link * auto-detection
Signature · 1 line
2.20.1
Simon Wunderlich
maintainerPATCH 4/4 batman-adv: BATMAN_V: aggregate OGMv2 packets
In reply to Simon WunderlichFrom: Linus Lüssing <[email protected]>
Instead of transmitting individual OGMv2 packets from the aggregation queue merge those OGMv2 packets into a single one and transmit this aggregate instead.
This reduces overhead as it saves an ethernet header and a transmission per aggregated OGMv2 packet.
--- net/batman-adv/bat_v_ogm.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
net/batman-adv/bat_v_ogm.c +27 -1
@@ -191,18 +191,44 @@ static void batadv_v_ogm_aggr_list_free(struct batadv_hard_iface *hard_iface)* batadv_v_ogm_aggr_send() - flush & send aggregation queue * @hard_iface: the interface with the aggregation queue to flush * +* Aggregates all OGMv2 packets currently in the aggregation queue into a +* single OGMv2 packet and transmits this aggregate. +* +* The aggregation queue is empty after this call. +* * Caller needs to hold the hard_iface->bat_v.aggr_list_lock. */ static void batadv_v_ogm_aggr_send (struct batadv_hard_iface *hard_iface) { +unsigned int aggr_len = hard_iface->bat_v.aggr_len; +struct sk_buff *skb_aggr; +unsigned int ogm_len;struct sk_buff *skb;lockdep_assert_held (&hard_iface->bat_v.aggr_list_lock); +if (!aggr_len) +return ; + + skb_aggr =dev_alloc_skb (aggr_len +ETH_HLEN +NET_IP_ALIGN ); +if (!skb_aggr) { +batadv_v_ogm_aggr_list_free (hard_iface); +return ; + } + +skb_reserve (skb_aggr,ETH_HLEN +NET_IP_ALIGN ); +skb_reset_network_header (skb_aggr); +while ((skb =skb_dequeue (&hard_iface->bat_v.aggr_list))) { hard_iface->bat_v.aggr_len -=batadv_v_ogm_len (skb); -batadv_v_ogm_send_to_if (skb, hard_iface); + + ogm_len =batadv_v_ogm_len (skb); +skb_put_data (skb_aggr, skb->data, ogm_len); + +consume_skb (skb); } + +batadv_v_ogm_send_to_if (skb_aggr, hard_iface); }/**
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Simon Wunderlich <[email protected]>
Date: Thu, 8 Aug 2019 15:06:15 +0200
Quoted 3 lines
here is a small feature/cleanup pull request of batman-adv to go into net-next.
Please pull or let me know of any problem!
Pulled, thanks.
That lockdep annotation in the 4th patch really helped with the review.