From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [PATCH 2/2] batman-adv: BATMAN_V: aggregate OGMv2 packets
Date: Sun, 4 Aug 2019 06:28:55 +0200 [thread overview]
Message-ID: <20190804042855.29327-3-linus.luessing@c0d3.blue> (raw)
In-Reply-To: <20190804042855.29327-1-linus.luessing@c0d3.blue>
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.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
net/batman-adv/bat_v_ogm.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index 36f78889..a743c67d 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -180,15 +180,40 @@ 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.
*/
static void batadv_v_ogm_aggr_send(struct batadv_hard_iface *hard_iface)
{
- struct sk_buff *skb;
+ unsigned int aggr_len = hard_iface->bat_v.aggr_len;
+ struct sk_buff *skb, *skb_aggr;
+ unsigned int ogm_len;
+
+ 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);
}
/**
--
2.22.0
next prev parent reply other threads:[~2019-08-04 4:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 4:28 [PATCH 0/2] batman-adv: BATMAN_V: OGMv2 packet aggregation Linus Lüssing
2019-08-04 4:28 ` [PATCH 1/2] batman-adv: BATMAN_V: introduce per hard-iface OGMv2 queues Linus Lüssing
2019-08-04 10:53 ` Sven Eckelmann
2019-08-04 4:28 ` Linus Lüssing [this message]
2019-08-04 6:20 ` [PATCH 0/2] batman-adv: BATMAN_V: OGMv2 packet aggregation 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=20190804042855.29327-3-linus.luessing@c0d3.blue \
--to=linus.luessing@c0d3.blue \
--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