(no subject)
Subsystems (2)
Hi,
This patchset introduces aggregation support for BATMAN V - as well as any other packet type with a broadcast destination.
Branch:
* https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/aggregation
Regards, Linus
---
Changelog:
v3:
* moved "Introduce packet type independent TVLV ..." from linus/neighhash to this patchset
(this patchset is more important, therefore swapping their order)
* removed the two already applied patches
* rebased to master
v2:
* reset skb->cb on the soft-iface reception path, too [PATCH 5/6] (thanks Sven!)
RFC->v1:
* removed tvlv (un)pack ctx wrappers
* fixed a crash when deaggregating ARP packets
* now compile tested down to 3.2, too (no issues found)
* now stress tested with multicast traffic of a larger, public mesh setup
PATCH v3 1/5 batman-adv: Introduce packet type independent TVLV handler API
Instead of having one TVLV registration function for OGMs and one for unicast packets, this patch adds a new, generic tvlv handler registratiorn function, which simply uses a packet type as parameter.
For now, this patch only migrates the multicast and gateway tvlv handlers to this new API, as these two have been tested and verified to work by the author.
The benefits of this new API:
* A more unified TVLV handling
* Easier to add TVLV capabilities to any new, upcoming packet type
* Does not rely on linearized skb data
Further ToDos (for later patches):
* Insert handler hooks for unicast_tvlv packets too and migrate BATADV_TVLV_{DAT,NC,TT,ROAM} to new API after further testing.
* Remove old TVLV handler API
---
Old changelog (from neighborhood patchset):
Changes in v4:
* remove unnecessary bug.h include (not needed anymore since the removal of the wrappers in v3)
Changes in v3:
* remove unnecessary skb_reset_network_header() call shortly before kfree_skb() batadv_iv_ogm_receive()
* remove tvlv (un)pack_ctx wrappers
(thanks Sven!)
Changes in v2:
* add includes for linux/{bug,printk}.h
* update forward declaration to "struct sk_buff;" in tvlv.h
* kerneldoc:
- change a "@tvlv_type" to "@packet_type",
- fixed batadv_tvlv_ogm_unpack_ctx() parameter kerneldoc
(thanks Sven!)
--- net/batman-adv/bat_iv_ogm.c | 6 +- net/batman-adv/bat_v_ogm.c | 17 +- net/batman-adv/distributed-arp-table.c | 4 +- net/batman-adv/gateway_common.c | 44 +++-- net/batman-adv/multicast.c | 37 +++-- net/batman-adv/network-coding.c | 4 +- net/batman-adv/tvlv.c | 295 ++++++++++++++++++++++++++++++--- net/batman-adv/tvlv.h | 22 ++- net/batman-adv/types.h | 24 ++- 9 files changed, 373 insertions(+), 80 deletions(-)
net/batman-adv/bat_iv_ogm.c +5 -1
@@ -1492,7 +1492,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, }if (if_outgoing ==BATADV_IF_DEFAULT ) -batadv_tvlv_ogm_receive (bat_priv, ogm_packet, orig_node); +batadv_tvlv_ogm_receive (bat_priv, skb, orig_node);/* if sender is a direct neighbor the sender mac equals * originator mac
@@ -1837,6 +1837,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, ogm_offset =0 ; ogm_packet = (struct batadv_ogm_packet *)skb->data; +WARN_ON (skb_network_offset (skb) !=0 ); +/* unpack the aggregated packets and process them one by one */ while (batadv_iv_ogm_aggr_packet (ogm_offset,skb_headlen (skb), ogm_packet->tvlv_len)) {
@@ -1847,6 +1849,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, packet_pos = skb->data + ogm_offset; ogm_packet = (struct batadv_ogm_packet *)packet_pos; + +skb_set_network_header (skb, ogm_offset); } ret =NET_RX_SUCCESS ;
net/batman-adv/bat_v_ogm.c +12 -5
@@ -594,7 +594,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,/** * batadv_v_ogm_process_per_outif - process a batman v OGM for an outgoing if * @bat_priv: the bat priv with all the soft interface information -* @ethhdr: the Ethernet header of the OGM2 +* @skb: the skb containing the OGM2 * @ogm2: OGM2 structure * @orig_node: Originator structure for which the OGM has been received * @neigh_node: the neigh_node through with the OGM has been received
@@ -603,13 +603,15 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,*/ static void batadv_v_ogm_process_per_outif (struct batadv_priv *bat_priv, -const struct ethhdr *ethhdr, +const struct sk_buff *skb,const struct batadv_ogm2_packet *ogm2,struct batadv_orig_node *orig_node,struct batadv_neigh_node *neigh_node,struct batadv_hard_iface *if_incoming,struct batadv_hard_iface *if_outgoing) { +const struct ethhdr *ethhdr =eth_hdr (skb); +unsigned int tvlv_offset =sizeof (*ogm2);int seqno_age;bool forward;
@@ -623,11 +625,16 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv,return ;/* only unknown & newer OGMs contain TVLVs we are interested in */ -if ((seqno_age >0 ) && (if_outgoing ==BATADV_IF_DEFAULT )) +if ((seqno_age >0 ) && (if_outgoing ==BATADV_IF_DEFAULT )) { +batadv_tvlv_containers_process2 (bat_priv, skb,BATADV_OGM2 , + tvlv_offset, +ntohs (ogm2->tvlv_len), + orig_node);batadv_tvlv_containers_process (bat_priv, true, orig_node,NULL ,NULL , (unsigned char *)(ogm2 +1 ),ntohs (ogm2->tvlv_len)); + }/* if the metric update went through, update routes if needed */ forward = batadv_v_ogm_route_update(bat_priv, ethhdr, ogm2, orig_node,
@@ -728,7 +735,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, path_throughput =min_t (u32, link_throughput, ogm_throughput); ogm_packet->throughput =htonl (path_throughput); -batadv_v_ogm_process_per_outif (bat_priv, ethhdr, ogm_packet, orig_node, +batadv_v_ogm_process_per_outif (bat_priv, skb, ogm_packet, orig_node, neigh_node, if_incoming,BATADV_IF_DEFAULT );
@@ -772,7 +779,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,continue ; } -batadv_v_ogm_process_per_outif (bat_priv, ethhdr, ogm_packet, +batadv_v_ogm_process_per_outif (bat_priv, skb, ogm_packet, orig_node, neigh_node, if_incoming, hard_iface);
net/batman-adv/distributed-arp-table.c +2 -2
@@ -734,7 +734,7 @@ static void batadv_dat_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,u8 flags, void *tvlv_value, u16 tvlv_value_len) { - if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) + if (flags & BATADV_TVLV_HANDLER_CIFNOTFND) clear_bit(BATADV_ORIG_CAPA_HAS_DAT, &orig->capabilities); else set_bit(BATADV_ORIG_CAPA_HAS_DAT, &orig->capabilities);
@@ -776,7 +776,7 @@ int batadv_dat_init(struct batadv_priv *bat_priv)batadv_tvlv_handler_register (bat_priv, batadv_dat_tvlv_ogm_handler_v1,NULL ,BATADV_TVLV_DAT ,1 , -BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +BATADV_TVLV_HANDLER_CIFNOTFND );batadv_dat_tvlv_container_update (bat_priv);return 0 ; }
net/batman-adv/gateway_common.c +27 -17
78 lines not on this page · raw message
net/batman-adv/multicast.c +23 -14
@@ -1110,23 +1110,23 @@ static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv,/** * batadv_mcast_tvlv_ogm_handler - process incoming multicast tvlv container * @bat_priv: the bat priv with all the soft interface information -* @orig: the orig_node of the ogm -* @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) * @tvlv_value: tvlv buffer containing the multicast data * @tvlv_value_len: tvlv buffer length +* @ctx: handler specific context information (here: orig_node) +* +* Return: Always NET_RX_SUCCESS. */ -static void batadv_mcast_tvlv_ogm_handler (struct batadv_priv *bat_priv, -struct batadv_orig_node *orig, -u8 flags, -void *tvlv_value, -u16 tvlv_value_len) +static int batadv_mcast_tvlv_ogm_handler (struct batadv_priv *bat_priv, +void *tvlv_value, +u16 tvlv_value_len, +void *ctx) { -bool orig_mcast_enabled = !(flags &BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +struct batadv_orig_node *orig = ctx; +bool orig_mcast_enabled = !!tvlv_value;u8 mcast_flags =BATADV_NO_FLAGS ;bool orig_initialized; -if (orig_mcast_enabled && tvlv_value && - (tvlv_value_len >=sizeof (mcast_flags))) +if (orig_mcast_enabled && (tvlv_value_len >=sizeof (mcast_flags))) mcast_flags = *(u8 *)tvlv_value;spin_lock_bh (&orig->mcast_handler_lock);
@@ -1161,6 +1161,8 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv, orig->mcast_flags = mcast_flags;spin_unlock_bh (&orig->mcast_handler_lock); + +return NET_RX_SUCCESS ; }/**
@@ -1169,9 +1171,12 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv,*/ void batadv_mcast_init (struct batadv_priv *bat_priv) { -batadv_tvlv_handler_register (bat_priv, batadv_mcast_tvlv_ogm_handler, -NULL ,BATADV_TVLV_MCAST ,2 , -BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +batadv_tvlv_handler_register2 (bat_priv, batadv_mcast_tvlv_ogm_handler, +BATADV_IV_OGM ,BATADV_TVLV_MCAST ,2 , +BATADV_TVLV_HANDLER_CIFNOTFND ); +batadv_tvlv_handler_register2 (bat_priv, batadv_mcast_tvlv_ogm_handler, +BATADV_OGM2 ,BATADV_TVLV_MCAST ,2 , +BATADV_TVLV_HANDLER_CIFNOTFND );INIT_DELAYED_WORK (&bat_priv->mcast.work, batadv_mcast_mla_update);batadv_mcast_start_timer (bat_priv);
@@ -1289,7 +1294,11 @@ void batadv_mcast_free(struct batadv_priv *bat_priv)cancel_delayed_work_sync (&bat_priv->mcast.work);batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_MCAST ,2 ); -batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_MCAST ,2 ); + +batadv_tvlv_handler_unregister2 (bat_priv,BATADV_IV_OGM , +BATADV_TVLV_MCAST ,2 ); +batadv_tvlv_handler_unregister2 (bat_priv,BATADV_OGM2 , +BATADV_TVLV_MCAST ,2 );/* safely calling outside of worker, as worker was canceled above */ batadv_mcast_mla_tt_retract (bat_priv,NULL );
net/batman-adv/network-coding.c +2 -2
@@ -137,7 +137,7 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,u8 flags, void *tvlv_value, u16 tvlv_value_len) { - if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) + if (flags & BATADV_TVLV_HANDLER_CIFNOTFND) clear_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities); else set_bit(BATADV_ORIG_CAPA_HAS_NC, &orig->capabilities);
@@ -176,7 +176,7 @@ int batadv_nc_mesh_init(struct batadv_priv *bat_priv)batadv_tvlv_handler_register (bat_priv, batadv_nc_tvlv_ogm_handler_v1,NULL ,BATADV_TVLV_NC ,1 , -BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +BATADV_TVLV_HANDLER_CIFNOTFND );batadv_nc_tvlv_container_update (bat_priv);return 0 ;
net/batman-adv/tvlv.c +269 -26
409 lines not on this page · raw message
net/batman-adv/tvlv.h +18 -4
@@ -22,7 +22,7 @@#include <linux/types.h> -struct batadv_ogm_packet ; +struct sk_buff ; void batadv_tvlv_container_register(struct batadv_priv *bat_priv, u8 type, u8 version,
@@ -31,11 +31,18 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,unsigned char **packet_buff, int *packet_buff_len, int packet_min_len);void batadv_tvlv_ogm_receive (struct batadv_priv *bat_priv, -struct batadv_ogm_packet *batadv_ogm_packet, +const struct sk_buff *skb,struct batadv_orig_node *orig_node);void batadv_tvlv_container_unregister (struct batadv_priv *bat_priv,u8 type,u8 version); +void batadv_tvlv_handler_register2 (struct batadv_priv *bat_priv, +int (*handler)(struct batadv_priv *bat_priv, +void *tvlv_value, +u16 tvlv_value_len, +void *ctx), +u8 packet_type,u8 tvlv_type, +u8 tvlv_version,u8 flags); void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, void (*optr)(struct batadv_priv *bat_priv, struct batadv_orig_node *orig,
@@ -46,14 +53,21 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, u8 *src, u8 *dst, void *tvlv_value, u16 tvlv_value_len), - u8 type, u8 version, u8 flags); + u8 tvlv_type, u8 tvlv_version, u8 flags); +void batadv_tvlv_handler_unregister2 (struct batadv_priv *bat_priv, +u8 packet_type,u8 tvlv_type, +u8 tvlv_version);void batadv_tvlv_handler_unregister (struct batadv_priv *bat_priv, -u8 type,u8 version); +u8 tvlv_type,u8 tvlv_version);int batadv_tvlv_containers_process (struct batadv_priv *bat_priv,bool ogm_source,struct batadv_orig_node *orig_node,u8 *src,u8 *dst,void *tvlv_buff,u16 tvlv_buff_len); +int batadv_tvlv_containers_process2 (struct batadv_priv *bat_priv, +const struct sk_buff *skb,u8 packet_type, +unsigned int tvlv_offset, +u16 tvlv_value_len,void *ctx);void batadv_tvlv_unicast_send (struct batadv_priv *bat_priv,u8 *src,u8 *dst,u8 type,u8 version,void *tvlv_value,u16 tvlv_value_len);
net/batman-adv/types.h +15 -9
@@ -1597,8 +1597,11 @@ struct batadv_tvlv_container {* incoming OGM packets * @unicast_handler: handler callback which is given the tvlv payload to process * on incoming unicast tvlv packets -* @type: tvlv type this handler feels responsible for -* @version: tvlv version this handler feels responsible for +* @handler: handler callback which is given the tvlv payload to process on +* incoming packets of the given packet type +* @packet_type: packet type this handler feels responsible for +* @tvlv_type: tvlv type this handler feels responsible for +* @tvlv_version: tvlv version this handler feels responsible for * @flags: tvlv handler flags * @refcount: number of contexts the object is used * @rcu: struct used for freeing in an RCU-safe manner
@@ -1611,8 +1614,11 @@ struct batadv_tvlv_handler {int (*unicast_handler)(struct batadv_priv *bat_priv,u8 *src,u8 *dst,void *tvlv_value,u16 tvlv_value_len); -u8 type; -u8 version; +int (*handler)(struct batadv_priv *bat_priv,void *tvlv_value, +u16 tvlv_value_len,void *ctx); +int packet_type; +u8 tvlv_type; +u8 tvlv_version;u8 flags;struct kref refcount;struct rcu_head rcu;
@@ -1620,15 +1626,15 @@ struct batadv_tvlv_handler {/** * enum batadv_tvlv_handler_flags - tvlv handler flags definitions -* @BATADV_TVLV_HANDLER_OGM_CIFNOTFND: tvlv ogm processing function will call +* @BATADV_TVLV_HANDLER_CIFNOTFND: tvlv processing function will call * this handler even if its type was not found (with no data) -* @BATADV_TVLV_HANDLER_OGM_CALLED: interval tvlv handling flag - the API marks +* @BATADV_TVLV_HANDLER_CALLED: internal tvlv handling flag - the API marks * a handler as being called, so it won't be called if the -* BATADV_TVLV_HANDLER_OGM_CIFNOTFND flag was set +* BATADV_TVLV_HANDLER_CIFNOTFND flag was set */ enum batadv_tvlv_handler_flags { -BATADV_TVLV_HANDLER_OGM_CIFNOTFND =BIT (1 ), -BATADV_TVLV_HANDLER_OGM_CALLED =BIT (2 ), +BATADV_TVLV_HANDLER_CIFNOTFND =BIT (1 ), +BATADV_TVLV_HANDLER_CALLED =BIT (2 ), };/**
Signature · 1 line
2.1.4
PATCH v3 2/5 batman-adv: Allow TVLVs greater than 128 bytes
In reply to Linus LüssingThe upcoming aggregation TVLVs will need to be able to hold larger broadcast packets too.
For one thing this patch increases the according stack buffer to 256 bytes to be able to handle the most common broadcast packet cases quickly.
For larger TVLVs, this patch will try to linearize skb data up to and including the TVLV within the received packet.
--- net/batman-adv/bat_iv_ogm.c | 4 ++-- net/batman-adv/bat_v_ogm.c | 4 ++-- net/batman-adv/tvlv.c | 20 +++++++++++--------- net/batman-adv/tvlv.h | 4 ++-- 4 files changed, 17 insertions(+), 15 deletions(-)
net/batman-adv/bat_iv_ogm.c +2 -2
@@ -1410,7 +1410,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,* @if_outgoing: the interface for which the packet should be considered */ static void -batadv_iv_ogm_process_per_outif (const struct sk_buff *skb,int ogm_offset, +batadv_iv_ogm_process_per_outif (struct sk_buff *skb,int ogm_offset,struct batadv_orig_node *orig_node,struct batadv_hard_iface *if_incoming,struct batadv_hard_iface *if_outgoing)
@@ -1614,7 +1614,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,* @ogm_offset: offset to the OGM which should be processed (for aggregates) * @if_incoming: the interface where this packet was receved */ -static void batadv_iv_ogm_process (const struct sk_buff *skb,int ogm_offset, +static void batadv_iv_ogm_process (struct sk_buff *skb,int ogm_offset,struct batadv_hard_iface *if_incoming) {struct batadv_priv *bat_priv =netdev_priv (if_incoming->soft_iface);
net/batman-adv/bat_v_ogm.c +2 -2
@@ -603,7 +603,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,*/ static void batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv, - const struct sk_buff *skb, + struct sk_buff *skb, const struct batadv_ogm2_packet *ogm2, struct batadv_orig_node *orig_node, struct batadv_neigh_node *neigh_node,
@@ -673,7 +673,7 @@ static bool batadv_v_ogm_aggr_packet(int buff_pos, int packet_len,* @ogm_offset: offset to the OGM which should be processed (for aggregates) * @if_incoming: the interface where this packet was receved */ -static void batadv_v_ogm_process (const struct sk_buff *skb,int ogm_offset, +static void batadv_v_ogm_process (struct sk_buff *skb,int ogm_offset,struct batadv_hard_iface *if_incoming) {struct batadv_priv *bat_priv =netdev_priv (if_incoming->soft_iface);
net/batman-adv/tvlv.c +11 -9
@@ -497,12 +497,12 @@ static void batadv_tvlv_call_unfound_handlers(struct batadv_priv *bat_priv,* any TVLV handler called successfully. Returns NET_RX_DROP otherwise. */ int batadv_tvlv_containers_process2 (struct batadv_priv *bat_priv, -const struct sk_buff *skb,u8 packet_type, +struct sk_buff *skb,u8 packet_type,unsigned int tvlv_offset,u16 tvlv_value_len,void *ctx) {struct batadv_tvlv_hdr *tvlv_hdr, tvlv_hdr_buff; -u8 *tvlv_value, tvlv_value_buff[128 ]; +u8 *tvlv_value, tvlv_value_buff[256 ];u16 tvlv_value_cont_len;int ret =NET_RX_SUCCESS ;
@@ -517,14 +517,16 @@ int batadv_tvlv_containers_process2(struct batadv_priv *bat_priv, tvlv_offset +=sizeof (*tvlv_hdr); tvlv_value_len -=sizeof (*tvlv_hdr); -if (tvlv_value_cont_len >sizeof (tvlv_value_buff)) { -pr_warn_once ("batman-adv: TVLVs greater than 128 bytes unsupported for now, ignoring\n" ); - goto skip_handler_call; - } -if (tvlv_value_cont_len > tvlv_value_len)return NET_RX_DROP ; +/* check for sufficient space either in stack buffer or +* in skb's linear data buffer +*/ +if (tvlv_value_cont_len >sizeof (tvlv_value_buff) && + !pskb_may_pull (skb, tvlv_offset + tvlv_value_cont_len)) +return NET_RX_DROP ; + tvlv_value =skb_header_pointer (skb, tvlv_offset, tvlv_value_cont_len, tvlv_value_buff);
@@ -535,7 +537,7 @@ int batadv_tvlv_containers_process2(struct batadv_priv *bat_priv, tvlv_hdr->type, tvlv_hdr->version, tvlv_value, tvlv_value_cont_len, ctx); -skip_handler_call: + tvlv_offset += tvlv_value_cont_len; tvlv_value_len -= tvlv_value_cont_len; }
@@ -626,7 +628,7 @@ int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,* OGM header. */ void batadv_tvlv_ogm_receive (struct batadv_priv *bat_priv, -const struct sk_buff *skb, +struct sk_buff *skb,struct batadv_orig_node *orig_node) {struct batadv_ogm_packet *ogm_packet;
net/batman-adv/tvlv.h +2 -2
@@ -31,7 +31,7 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,unsigned char **packet_buff, int *packet_buff_len, int packet_min_len);void batadv_tvlv_ogm_receive (struct batadv_priv *bat_priv, -const struct sk_buff *skb, +struct sk_buff *skb,struct batadv_orig_node *orig_node);void batadv_tvlv_container_unregister (struct batadv_priv *bat_priv,u8 type,u8 version);
@@ -65,7 +65,7 @@ int batadv_tvlv_containers_process(struct batadv_priv *bat_priv, u8 *src, u8 *dst, void *tvlv_buff, u16 tvlv_buff_len);int batadv_tvlv_containers_process2 (struct batadv_priv *bat_priv, -const struct sk_buff *skb,u8 packet_type, +struct sk_buff *skb,u8 packet_type,unsigned int tvlv_offset,u16 tvlv_value_len,void *ctx); void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src,
Signature · 1 line
2.1.4
PATCH v3 3/5 batman-adv: aggregation packet reception
In reply to Linus LüssingThis patch implements the de-aggregation and reception of broadcast aggregation packets, which are introduced through the new BATADV_BCAST_AGGR packet type.
It enables us to receive aggregation packets consisting of any batman packet type with a broadcast ethernet destination.
--- Makefile | 3 + gen-compat-autoconf.sh | 1 + net/batman-adv/Makefile | 1 + net/batman-adv/aggregation.c | 177 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/aggregation.h | 51 ++++++++++++ net/batman-adv/main.c | 9 ++ net/batman-adv/packet.h | 18 ++++ net/batman-adv/routing.c | 61 ++++++++++++++ net/batman-adv/routing.h | 2 + net/batman-adv/soft-interface.c | 6 ++ net/batman-adv/tvlv.c | 13 ++- net/batman-adv/types.h | 38 +++++++++ 12 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 net/batman-adv/aggregation.c create mode 100644 net/batman-adv/aggregation.h
Makefile +3 -0
@@ -29,6 +29,8 @@ export CONFIG_BATMAN_ADV_DAT=y export CONFIG_BATMAN_ADV_NC=n # B.A.T.M.A.N. multicast optimizations: export CONFIG_BATMAN_ADV_MCAST=y +# B.A.T.M.A.N. generic broadcast aggregation: +export CONFIG_BATMAN_ADV_AGGR=y # B.A.T.M.A.N. V routing algorithm (experimental): export CONFIG_BATMAN_ADV_BATMAN_V=n
@@ -83,6 +85,7 @@ BUILD_FLAGS := \ CONFIG_BATMAN_ADV_DAT=$(CONFIG_BATMAN_ADV_DAT) \ CONFIG_BATMAN_ADV_NC=$(CONFIG_BATMAN_ADV_NC) \ CONFIG_BATMAN_ADV_MCAST=$(CONFIG_BATMAN_ADV_MCAST) \ + CONFIG_BATMAN_ADV_AGGR=$(CONFIG_BATMAN_ADV_AGGR) \ CONFIG_BATMAN_ADV_BATMAN_V=$(CONFIG_BATMAN_ADV_BATMAN_V) \ INSTALL_MOD_DIR=updates/
gen-compat-autoconf.sh +1 -0
@@ -41,6 +41,7 @@ gen_config 'CONFIG_BATMAN_ADV_DEBUG' ${CONFIG_BATMAN_ADV_DEBUG:="n"} >> "${TMP}" gen_config 'CONFIG_BATMAN_ADV_BLA' ${CONFIG_BATMAN_ADV_BLA:="y"} >> "${TMP}" gen_config 'CONFIG_BATMAN_ADV_DAT' ${CONFIG_BATMAN_ADV_DAT:="y"} >> "${TMP}" gen_config 'CONFIG_BATMAN_ADV_MCAST' ${CONFIG_BATMAN_ADV_MCAST:="y"} >> "${TMP}" +gen_config 'CONFIG_BATMAN_ADV_AGGR' ${CONFIG_BATMAN_ADV_AGGR:="y"} >> "${TMP}" gen_config 'CONFIG_BATMAN_ADV_NC' ${CONFIG_BATMAN_ADV_NC:="n"} >> "${TMP}" gen_config 'CONFIG_BATMAN_ADV_BATMAN_V' ${CONFIG_BATMAN_ADV_BATMAN_V:="n"} >> "${TMP}"
net/batman-adv/Makefile +1 -0
@@ -17,6 +17,7 @@ # obj-$(CONFIG_BATMAN_ADV) += batman-adv.o +batman-adv-$(CONFIG_BATMAN_ADV_AGGR) += aggregation.o batman-adv-y += bat_algo.o batman-adv-y += bat_iv_ogm.o batman-adv-$(CONFIG_BATMAN_ADV_BATMAN_V) += bat_v.o
net/batman-adv/aggregation.c new file +177 -0
177 lines not on this page · raw message
net/batman-adv/aggregation.h new file +51 -0
51 lines not on this page · raw message
net/batman-adv/main.c +9 -0
@@ -47,6 +47,7 @@#include <net/rtnetlink.h> #include <uapi/linux/batman_adv.h> +#include "aggregation.h" #include "bat_algo.h" #include "bat_iv_ogm.h" #include "bat_v.h"
@@ -179,6 +180,10 @@ int batadv_mesh_init(struct net_device *soft_iface)INIT_HLIST_HEAD (&bat_priv->softif_vlan_list);INIT_HLIST_HEAD (&bat_priv->tp_list); + ret =batadv_aggr_mesh_init (bat_priv); +if (ret <0 ) + goto err; + ret =batadv_v_mesh_init (bat_priv);if (ret <0 ) goto err;
@@ -226,6 +231,7 @@ void batadv_mesh_free(struct net_device *soft_iface)batadv_gw_node_free (bat_priv); +batadv_aggr_mesh_free (bat_priv);batadv_v_mesh_free (bat_priv);batadv_nc_mesh_free (bat_priv);batadv_dat_free (bat_priv);
@@ -507,6 +513,7 @@ static void batadv_recv_handler_init(void)BUILD_BUG_ON (sizeof (struct batadv_unicast_packet ) !=10 );BUILD_BUG_ON (sizeof (struct batadv_unicast_4addr_packet ) !=18 );BUILD_BUG_ON (sizeof (struct batadv_frag_packet ) !=20 ); +BUILD_BUG_ON (sizeof (struct batadv_aggr_packet ) !=4 );BUILD_BUG_ON (sizeof (struct batadv_bcast_packet ) !=14 );BUILD_BUG_ON (sizeof (struct batadv_coded_packet ) !=46 );BUILD_BUG_ON (sizeof (struct batadv_unicast_tvlv_packet ) !=20 );
@@ -533,6 +540,8 @@ static void batadv_recv_handler_init(void) batadv_rx_handler[BATADV_ICMP ] = batadv_recv_icmp_packet;/* Fragmented packets */ batadv_rx_handler[BATADV_UNICAST_FRAG ] = batadv_recv_frag_packet; +/* Aggregation packets */ + batadv_rx_handler[BATADV_BCAST_AGGR ] = batadv_recv_aggr_packet; }int
net/batman-adv/packet.h +18 -0
@@ -30,6 +30,7 @@* @BATADV_CODED: network coded packets * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V +* @BATADV_AGGR: broadcast aggregation packets * * @BATADV_UNICAST: unicast packets carrying unicast payload traffic * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original
@@ -46,6 +47,7 @@ enum batadv_packettype {BATADV_CODED =0x02 ,BATADV_ELP =0x03 ,BATADV_OGM2 =0x04 , +BATADV_BCAST_AGGR =0x05 ,/* 0x40 - 0x7f: unicast */ #define BATADV_UNICAST_MIN 0x40 BATADV_UNICAST = 0x40,
@@ -153,6 +155,8 @@ enum batadv_bla_claimframe {* @BATADV_TVLV_TT: translation table tvlv * @BATADV_TVLV_ROAM: roaming advertisement tvlv * @BATADV_TVLV_MCAST: multicast capability tvlv +* @BATADV_TVLV_AGGR: generic broadcast aggregation capability tvlv +* @BATADV_ANYTYPE: internal place holder for TVLV handlers, not for the "wire" */ enum batadv_tvlv_type {BATADV_TVLV_GW =0x01 ,
@@ -161,6 +165,8 @@ enum batadv_tvlv_type {BATADV_TVLV_TT =0x04 ,BATADV_TVLV_ROAM =0x05 ,BATADV_TVLV_MCAST =0x06 , +BATADV_TVLV_AGGR =0x07 , + BATADV_TVLV_ANY = 0xff, };#pragma pack(2)
@@ -455,6 +461,18 @@ struct batadv_frag_packet { };/** +* struct batadv_aggr_packet - aggregation packet for broadcast packets +* @packet_type: batman-adv packet type, part of the general header +* @version: batman-adv protocol version, part of the genereal header +* @tvlv_len: length of tvlv data following the aggregation header +*/ +struct batadv_aggr_packet { +u8 packet_type; +u8 version;/* batman version field */ +__be16 tvlv_len; +}; + +/** * struct batadv_bcast_packet - broadcast packet for network payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header
net/batman-adv/routing.c +61 -0
73 lines not on this page · raw message
net/batman-adv/routing.h +2 -0
@@ -37,6 +37,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct batadv_hard_iface *recv_if);int batadv_recv_frag_packet (struct sk_buff *skb,struct batadv_hard_iface *iface); +int batadv_recv_aggr_packet (struct sk_buff *skb, +struct batadv_hard_iface *recv_if);int batadv_recv_bcast_packet (struct sk_buff *skb,struct batadv_hard_iface *recv_if); int batadv_recv_tt_query(struct sk_buff *skb,
net/batman-adv/soft-interface.c +6 -0
@@ -961,6 +961,12 @@ static const struct { { "frag_rx_bytes" }, { "frag_fwd" }, { "frag_fwd_bytes" }, +#ifdef CONFIG_BATMAN_ADV_AGGR + { "aggr_rx" }, + { "aggr_rx_bytes" }, + { "aggr_parts_rx" }, + { "aggr_parts_rx_bytes" }, +#endif { "tt_request_tx" }, { "tt_request_rx" }, { "tt_response_tx" },
net/batman-adv/tvlv.c +11 -2
@@ -87,10 +87,12 @@ batadv_tvlv_handler_get(struct batadv_priv *bat_priv, int packet_type,if (tvlv_handler_tmp->packet_type != packet_type)continue ; -if (tvlv_handler_tmp->tvlv_type != tvlv_type) +if (tvlv_handler_tmp->tvlv_type !=BATADV_TVLV_ANY && + tvlv_handler_tmp->tvlv_type != tvlv_type)continue ; -if (tvlv_handler_tmp->tvlv_version != tvlv_version) +if (tvlv_handler_tmp->tvlv_type !=BATADV_TVLV_ANY && + tvlv_handler_tmp->tvlv_version != tvlv_version)continue ;if (!kref_get_unless_zero (&tvlv_handler_tmp->refcount))
@@ -430,6 +432,7 @@ static int batadv_tvlv_call_handler2(struct batadv_priv *bat_priv, u8 tvlv_version, void *tvlv_value, u16 tvlv_value_len, void *ctx) { + struct batadv_tvlv_handler_ctx *handler_ctx;struct batadv_tvlv_handler *tvlv_handler;int ret;
@@ -438,6 +441,12 @@ static int batadv_tvlv_call_handler2(struct batadv_priv *bat_priv,if (!tvlv_handler)return NET_RX_DROP ; +if (tvlv_handler->flags &BATADV_TVLV_HANDLER_MORECTX ) { + handler_ctx = (struct batadv_tvlv_handler_ctx *)ctx; + handler_ctx->tvlv_type = tvlv_type; + handler_ctx->tvlv_version = tvlv_version; + } + ret = tvlv_handler->handler (bat_priv, tvlv_value, tvlv_value_len, ctx); tvlv_handler->flags |=BATADV_TVLV_HANDLER_CALLED ;
net/batman-adv/types.h +38 -0
@@ -556,6 +556,10 @@ struct batadv_bcast_duplist_entry {* @BATADV_CNT_FRAG_RX_BYTES: received fragment traffic bytes counter * @BATADV_CNT_FRAG_FWD: forwarded fragment traffic packet counter * @BATADV_CNT_FRAG_FWD_BYTES: forwarded fragment traffic bytes counter +* @BATADV_CNT_AGGR_RX: received aggregation traffic packet count +* @BATADV_CNT_AGGR_RX_BYTES: received aggregation traffic bytes counter +* @BATADV_CNT_AGGR_PARTS_RX: received aggregated traffic packet counter +* @BATADV_CNT_AGGR_PARTS_RX_BYTES: received aggregated bytes counter * @BATADV_CNT_TT_REQUEST_TX: transmitted tt req traffic packet counter * @BATADV_CNT_TT_REQUEST_RX: received tt req traffic packet counter * @BATADV_CNT_TT_RESPONSE_TX: transmitted tt resp traffic packet counter
@@ -599,6 +603,12 @@ enum batadv_counters {BATADV_CNT_FRAG_RX_BYTES ,BATADV_CNT_FRAG_FWD ,BATADV_CNT_FRAG_FWD_BYTES , +#ifdef CONFIG_BATMAN_ADV_AGGR +BATADV_CNT_AGGR_RX , +BATADV_CNT_AGGR_RX_BYTES , +BATADV_CNT_AGGR_PARTS_RX , +BATADV_CNT_AGGR_PARTS_RX_BYTES , +#endifBATADV_CNT_TT_REQUEST_TX ,BATADV_CNT_TT_REQUEST_RX , BATADV_CNT_TT_RESPONSE_TX,
@@ -1625,16 +1635,44 @@ struct batadv_tvlv_handler { };/** +* struct batadv_tvlv_handler_ctx - handler meta information +* @tvlv_type: type of the processed tvlv +* @tvlv_version: version of the processed tvlv +* +* This structure is provided to a tvlv handler if the +* BATADV_TVLV_HANDLER_MORECTX flag was set during registration. +*/ +struct batadv_tvlv_handler_ctx { +u8 tvlv_type; +u8 tvlv_version; +}; + +/** +* struct batadv_aggr_ctx - aggregation tvlv context +* @handler: information regarding the tvlv handler itself +* @recv_if: interface the packet was received from +* @h_source: ethernet address of the neighbor the packet was received from +*/ +struct batadv_aggr_ctx { +struct batadv_tvlv_handler_ctx handler; +struct batadv_hard_iface *recv_if; +unsigned char *h_source; +}; + +/** * enum batadv_tvlv_handler_flags - tvlv handler flags definitions * @BATADV_TVLV_HANDLER_CIFNOTFND: tvlv processing function will call * this handler even if its type was not found (with no data) * @BATADV_TVLV_HANDLER_CALLED: internal tvlv handling flag - the API marks * a handler as being called, so it won't be called if the * BATADV_TVLV_HANDLER_CIFNOTFND flag was set +* @BATADV_TVLV_HANDLER_MORECTX: tvlv processing function will be provided with +* handler specific context (e.g. tvlv type and version) */ enum batadv_tvlv_handler_flags {BATADV_TVLV_HANDLER_CIFNOTFND =BIT (1 ),BATADV_TVLV_HANDLER_CALLED =BIT (2 ), +BATADV_TVLV_HANDLER_MORECTX =BIT (3 ), };/**
Signature · 1 line
2.1.4
PATCH v3 4/5 batman-adv: aggregation packet queueing and transmission
In reply to Linus LüssingThis patch implements the queueing of any broadcast packet and its following tranmission in an aggregation packet.
A broadcast packet is usually queued for up to 100ms (plus-minus some jitter) or about 50ms on average.
However if the aggregation worker cannot keep up with emptying its queue, a 10 to 20 times faster aggregation packet transmission rate is used.
If an aggregation queue still runs full then broadcast packets are handed over to the driver directly without aggregation, leaving it up to the driver to either transmit or drop it, for instance due to congestion.
--- net/batman-adv/aggregation.c | 475 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/aggregation.h | 31 +++ net/batman-adv/bat_iv_ogm.c | 6 +- net/batman-adv/hard-interface.c | 5 + net/batman-adv/main.c | 10 + net/batman-adv/main.h | 1 + net/batman-adv/originator.c | 2 + net/batman-adv/send.c | 9 + net/batman-adv/soft-interface.c | 11 +- net/batman-adv/sysfs.c | 5 +- net/batman-adv/types.h | 42 +++- 11 files changed, 590 insertions(+), 7 deletions(-)
net/batman-adv/aggregation.c +475 -0
@@ -18,15 +18,430 @@#include "aggregation.h" #include "main.h" +#include <linux/atomic.h> +#include <linux/bitops.h> #include <linux/etherdevice.h> #include <linux/if_ether.h> +#include <linux/jiffies.h> +#include <linux/kernel.h> +#include <linux/netdevice.h> +#include <linux/random.h> #include <linux/skbuff.h> +#include <linux/spinlock.h> #include <linux/string.h> #include <linux/types.h> +#include <linux/workqueue.h> +#include "send.h" #include "tvlv.h" /** +* batadv_aggr_hardif_start - schedule aggregation packet transmission +* @hard_iface: the hard interface to schedule the transmission on +* +* Schedules an aggregation packet transmission for the next aggregation +* interval, plus/minus some jitter. +*/ +void batadv_aggr_hardif_start (struct batadv_hard_iface *hard_iface) +{ +unsigned int msecs =BATADV_MAX_AGGREGATION_MS *1000 ; + +/* msecs * [0.9, 1.1] */ + msecs +=prandom_u32 () % (msecs /5 ) - (msecs /10 ); +queue_delayed_work (batadv_event_workqueue, &hard_iface->aggr.work, +msecs_to_jiffies (msecs /1000 )); +} + +/** +* batadv_aggr_hardif_start_urgent - schedule urgent aggregate transmission +* @hard_iface: the hard interface to schedule the transmission on +* +* Schedules an urgent aggregation packet transmission, plus/minus some jitter. +* That is at some time between an interval 10 to 20 times faster than the +* regular aggregation interval. +*/ +static void +batadv_aggr_hardif_start_urgent (struct batadv_hard_iface *hard_iface) +{ +unsigned int msecs =BATADV_MAX_AGGREGATION_MS *1000 ; + +/* msecs * [0.05, 0.1] */ + msecs = (msecs /20 ) +prandom_u32 () % (msecs /20 ); +queue_delayed_work (batadv_event_workqueue, &hard_iface->aggr.work, +msecs_to_jiffies (msecs /1000 )); +} + +/** +* batadv_aggr_skb_queue_free - free all elements in an skb queue +* @head: the skb queue to empty +* +* Empties an skb queue and frees all the skbs it contained. +*/ +static void batadv_aggr_skb_queue_free (struct sk_buff_head *head) +{ +struct sk_buff *skb; + +while ((skb =skb_dequeue (head))) +kfree_skb (skb); +} + +/** +* batadv_aggr_hardif_stop - shutdown an aggregation routine +* @hard_iface: the interface to stop aggregation on +* +* Stops an aggregation timer and destroys the packets queued +* on the given interface. +*/ +void batadv_aggr_hardif_stop (struct batadv_hard_iface *hard_iface) +{ +cancel_delayed_work_sync (&hard_iface->aggr.work); + +spin_lock_bh (&hard_iface->aggr.aggr_list_lock); +batadv_aggr_skb_queue_free (&hard_iface->aggr.aggr_list); +spin_unlock_bh (&hard_iface->aggr.aggr_list_lock); +} + +/** +* batadv_aggr_chunk_reserve - reserve space in an aggregation packet +* @hard_iface: the interface to reserve on +* @skb: the to be aggregated packet to reserve for +* @size: size of the aggregation packet +* +* Tries to reserve space in the aggregation packet for the given skb. +* If reservation was successful, then the size of the to be allocated +* aggregation packet is increased accordingly. +* +* Return: True if there was enough space in the aggregation packet left, +* false otherwise. +*/ +static bool batadv_aggr_chunk_reserve (struct batadv_hard_iface *hard_iface, +struct sk_buff *skb, +int *size) +{ +unsigned int len = skb->len +sizeof (struct batadv_tvlv_hdr ); + + len -=sizeof (((struct batadv_aggr_packet *)0 )->packet_type); + len -=sizeof (((struct batadv_aggr_packet *)0 )->version); + +if (*size + len > hard_iface->net_dev->mtu) +return false; + + *size += len; +return true; +} + +/** +* batadv_aggr_get_chunk - gets a chunk of packets from the aggregation queue +* @hard_iface: the interface to get to be aggregated packets from +* @head: queue to stage a chunk of to be aggregated+transmitted packets on +* @size: size of the aggregation packet +* +* Tries to grab as many packets from the aggregation queue as fit into a +* single aggregation packet. +* +* Return: True if there are no packets in the aggregation queue +* of the provided interface left afterwards, false otherwise. +*/ +static bool batadv_aggr_get_chunk (struct batadv_hard_iface *hard_iface, +struct sk_buff_head *head, +int *size) +{ +struct sk_buff *skb, *skb_tmp; +bool emptied = true; + + *size =sizeof (struct batadv_aggr_packet ); + +if (skb_queue_empty (&hard_iface->aggr.aggr_list)) +return emptied; + +spin_lock_bh (&hard_iface->aggr.aggr_list_lock); + skb_queue_walk_safe(&hard_iface->aggr.aggr_list, skb, skb_tmp) { +if (!batadv_aggr_chunk_reserve (hard_iface, skb, size)) { + emptied = false; +break ; + } + +skb_unlink (skb, &hard_iface->aggr.aggr_list); +skb_queue_tail (head, skb); + } +spin_unlock_bh (&hard_iface->aggr.aggr_list_lock); + +return emptied; +} + +/** +* batadv_aggr_alloc_skb - allocate an aggregation packet +* @size: size of the to be allocated packet (excluding ethernet header) +* +* Allocates a broadcast aggregation packet. +* +* Return: An aggregation packet on success, NULL otherwise. +*/ +static struct sk_buff *batadv_aggr_alloc_skb (int size) +{ +struct batadv_aggr_packet *aggr_packet; +struct sk_buff *skb; +unsigned char *skb_buff; +unsigned int offset; + + skb =dev_alloc_skb (size +ETH_HLEN +NET_IP_ALIGN ); +if (!skb) +return NULL ; + +skb_reserve (skb,ETH_HLEN +NET_IP_ALIGN ); +skb_reset_network_header (skb); + + skb_buff =skb_put (skb,sizeof (*aggr_packet)); + aggr_packet = (struct batadv_aggr_packet *)skb_buff; + aggr_packet->packet_type =BATADV_BCAST_AGGR ; + aggr_packet->version =BATADV_COMPAT_VERSION ; + + offset =skb_network_offset (skb) +sizeof (*aggr_packet); +skb_set_transport_header (skb, offset); + +return skb; +} + +/** +* batadv_aggr_get_pkttypes - get the packet type of a batman packet +* @skb: the packet to get the type from +* +* Return: The packet type of the provided batman packet. +*/ +static u8 batadv_aggr_get_pkttype (struct sk_buff *skb) +{ +struct batadv_aggr_packet *packet; + + packet = (struct batadv_aggr_packet *)skb_network_header (skb); + +return packet->packet_type; +} + +/** +* batadv_aggr_put_tvlvhdr - append a tvlv header to an skb +* @skb: the aggregation packet to append the tvlv header to +* @type: the packet (= tvlv) type to set in the tvlv header +* @len: the size of the to be added tvlv data +* +* Appends a tvlv header to the given aggregation packet and sets its type and +* length as provided. +*/ +static void batadv_aggr_put_tvlvhdr (struct sk_buff *skb,u8 type, +unsigned int len) +{ +struct batadv_tvlv_hdr *tvlv_hdr; + + tvlv_hdr = (struct batadv_tvlv_hdr *)skb_put (skb,sizeof (*tvlv_hdr)); + + tvlv_hdr->type = type; + tvlv_hdr->version =1 ; + tvlv_hdr->len =htons (len); +} + +/** +* batadv_aggr_queue_is_full - check for slots left in aggregation queue +* @hard_iface: the interface to check +* +* Return: True if if the queue is full, false otherwise. +*/ +static inline bool +batadv_aggr_queue_is_full (struct batadv_hard_iface *hard_iface) +{ +struct sk_buff_head *head = &hard_iface->aggr.aggr_list; + +return skb_queue_len (head) >=BATADV_AGGR_QUEUE_LEN ; +} + +/** +* batadv_aggr_squash_chunk - squash packets into an aggregate +* @head: a list of to be squashed packets +* @size: the size of the to be created aggregation packet +* (excluding the ethernet header) +* +* Allocates an aggregation packet and squashes the provided list of broadcast +* packets into it. The provided list of packets is freed/consumed. +* +* Return: An aggregation packet ready for transmission on success, NULL +* otherwise. +*/ +static struct sk_buff * +batadv_aggr_squash_chunk (struct sk_buff_head *head, +int size) +{ +struct sk_buff *skb, *skb_tmp, *skb_aggr; +struct batadv_aggr_packet *aggr_packet; +unsigned int len, offset, tvlv_len =0 ; +unsigned char *to; +u8 type; + +if (skb_queue_empty (head)) +return NULL ; + + skb_aggr =batadv_aggr_alloc_skb (size); +if (!skb_aggr) { +batadv_aggr_skb_queue_free (head); +return NULL ; + } + + aggr_packet = (struct batadv_aggr_packet *)skb_network_header (skb_aggr); + + skb_queue_walk_safe(head, skb, skb_tmp) { + offset =skb_network_offset (skb); + offset +=sizeof (aggr_packet->packet_type); + offset +=sizeof (aggr_packet->version); + len = skb->len - offset; + type =batadv_aggr_get_pkttype (skb); + +batadv_aggr_put_tvlvhdr (skb_aggr, type, len); + to =skb_put (skb_aggr, len); +skb_copy_bits (skb, offset, to, len); +skb_unlink (skb, head); +consume_skb (skb); + + tvlv_len += len +sizeof (struct batadv_tvlv_hdr ); + } + + aggr_packet->tvlv_len =htons (tvlv_len); + +return skb_aggr; +} + +/** +* __batadv_aggr_send_chunk - send a prepared aggregation packet +* @hard_iface: the interface to transmit on +* @skb: the prepared aggregation packet to send +*/ +static void __batadv_aggr_send_chunk (struct batadv_hard_iface *hard_iface, +struct sk_buff *skb) +{ +struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); + +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_TX ); +batadv_add_counter (bat_priv,BATADV_CNT_AGGR_TX_BYTES , + skb->len +ETH_HLEN ); + +/* ToDo: Track transmission failures? */ +batadv_send_skb_packet (skb, hard_iface, batadv_broadcast_addr); +} + +/** +* batadv_aggr_send_chunk - prepare and transmit an aggregation packet +* @hard_iface: the interface to transmit on +* +* Fetches as many packets from the aggregation queue of the provided interface +* as fit into a single aggregation packet. Then aggregates them into such an +* aggregation packet and transmits the final aggregate. +* +* Return: True if there are no packets in the aggregation queue +* of the provided interface left afterwards, false otherwise. +*/ +static bool batadv_aggr_send_chunk (struct batadv_hard_iface *hard_iface) +{ +struct sk_buff_head head; +struct sk_buff *skb; +int size =0 ; +bool emptied; + +skb_queue_head_init (&head); + emptied =batadv_aggr_get_chunk (hard_iface, &head, &size); + + skb =batadv_aggr_squash_chunk (&head, size); +if (!skb) + goto out; + +__batadv_aggr_send_chunk (hard_iface, skb); + +out: +return emptied; +} + +/** +* batadv_aggr_work - periodic aggregation worker +* @work: work queue item +* +* Prepares and sends out an aggregation packet. In the end rearms the timer +* either to the next aggregation interval, or if there were still packets left +* in the aggregation queue, sets it to an earlier time. +*/ +static void batadv_aggr_work (struct work_struct *work) +{ +struct batadv_hard_iface_aggr *aggr; +struct batadv_hard_iface *hard_iface; +struct batadv_priv *bat_priv; +bool emptied; + + aggr = container_of(work, struct batadv_hard_iface_aggr, work.work); + hard_iface = container_of(aggr, struct batadv_hard_iface, aggr); + bat_priv =netdev_priv (hard_iface->soft_iface); + + emptied =batadv_aggr_send_chunk (hard_iface); +if (emptied) { +batadv_aggr_hardif_start (hard_iface); + }else { +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_URGENT ); +batadv_aggr_hardif_start_urgent (hard_iface); + } +} + +/** +* batadv_aggr_queue - queue a broadcast packet for aggregation +* @skb: the packet to queue +* @hard_iface: the interface to queue on +* +* Return: NET_XMIT_SUCCESS if the skb was queued, NET_XMIT_DROP otherwise. +* The former consumes the skb. +*/ +int batadv_aggr_queue (struct sk_buff *skb,struct batadv_hard_iface *hard_iface) +{ +struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); + +if (!atomic_read (&bat_priv->aggregation)) +return NET_XMIT_DROP ; + +if (atomic_read (&bat_priv->aggr_num_disabled)) +return NET_XMIT_DROP ; + +if (batadv_aggr_queue_is_full (hard_iface)) { +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_QUEUE_FULL ); +return NET_XMIT_DROP ; + } + +spin_lock_bh (&hard_iface->aggr.aggr_list_lock); +skb_queue_tail (&hard_iface->aggr.aggr_list, skb); +spin_unlock_bh (&hard_iface->aggr.aggr_list_lock); + +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX ); +batadv_add_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX_BYTES , + skb->len +ETH_HLEN ); + +return NET_XMIT_SUCCESS ; +} + +/** +* batadv_aggr_purge_orig - reset originator aggregation state modifications +* @orig: the originator which is going to get purged +*/ +void batadv_aggr_purge_orig (struct batadv_orig_node *orig) +{ +struct batadv_priv *bat_priv = orig->bat_priv; + +if (!test_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capabilities) && +test_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capa_initialized)) +atomic_dec (&bat_priv->aggr_num_disabled); +} + +/** +* batadv_aggr_hardif_init - initialize an interface for aggregation +* @hard_iface: the interface to initialize +*/ +void batadv_aggr_hardif_init (struct batadv_hard_iface *hard_iface) +{ +INIT_DELAYED_WORK (&hard_iface->aggr.work, batadv_aggr_work); +skb_queue_head_init (&hard_iface->aggr.aggr_list); +spin_lock_init (&hard_iface->aggr.aggr_list_lock); +} + +/** * batadv_aggr_add_counter_rx - update aggregation rx statistics * @bat_priv: the bat priv with all the soft interface information * @skb: the skb to count
@@ -150,6 +565,55 @@ static int batadv_aggr_tvlv_handler(struct batadv_priv *bat_priv, }/** +* batadv_aggr_ogm_handler - process incoming aggregation tvlv container +* @bat_priv: the bat priv with all the soft interface information +* @tvlv_value: tvlv buffer containing an aggregated broadcast packet +* @tvlv_value_len: tvlv buffer length +* @ctx: handler specific context information +* (here: recv_if, h_source and packet type of aggregate) +* +* Parses an aggregation tvlv attached to an originator message and updates +* aggregation capabilities accordingly. +* +* Return: Always NET_RX_SUCCESS. +*/ +static int batadv_aggr_ogm_handler (struct batadv_priv *bat_priv, +void *tvlv_value,u16 tvlv_value_len, +void *ctx) +{ +struct batadv_orig_node *orig = ctx; +bool orig_aggr_enabled = !!tvlv_value; +bool orig_initialized; + + orig_initialized =test_bit (BATADV_ORIG_CAPA_HAS_AGGR , + &orig->capa_initialized); + +/* If aggregation support is turned on decrease the disabled aggregation +* node counter only if we had increased it for this node before. If +* this is a completely new orig_node no need to decrease the counter. +*/ +if (orig_aggr_enabled && + !test_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capabilities)) { +if (orig_initialized) +atomic_dec (&bat_priv->aggr_num_disabled); +set_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capabilities); +/* If aggregation support is being switched off or if this is an initial +* OGM without aggregation support then increase the disabled +* aggregation node counter. +*/ + }else if (!orig_aggr_enabled && + (test_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capabilities) || + !orig_initialized)) { +atomic_inc (&bat_priv->aggr_num_disabled); +clear_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capabilities); + } + +set_bit (BATADV_ORIG_CAPA_HAS_AGGR , &orig->capa_initialized); + +return NET_RX_SUCCESS ; +} + +/** * batadv_aggr_mesh_init - initialise the generic aggregation engine * @bat_priv: the bat priv with all the soft interface information *
@@ -160,6 +624,13 @@ int batadv_aggr_mesh_init(struct batadv_priv *bat_priv)batadv_tvlv_handler_register2 (bat_priv, batadv_aggr_tvlv_handler,BATADV_BCAST_AGGR ,BATADV_TVLV_ANY ,1 ,BATADV_TVLV_HANDLER_MORECTX ); +batadv_tvlv_handler_register2 (bat_priv, batadv_aggr_ogm_handler, +BATADV_IV_OGM ,BATADV_TVLV_AGGR ,1 , +BATADV_TVLV_HANDLER_CIFNOTFND ); +batadv_tvlv_handler_register2 (bat_priv, batadv_aggr_ogm_handler, +BATADV_OGM2 ,BATADV_TVLV_AGGR ,1 , +BATADV_TVLV_HANDLER_CIFNOTFND ); +batadv_tvlv_container_register (bat_priv,BATADV_TVLV_AGGR ,1 ,NULL ,0 );return 0 ;
@@ -172,6 +643,10 @@ int batadv_aggr_mesh_init(struct batadv_priv *bat_priv)void batadv_aggr_mesh_free (struct batadv_priv *bat_priv) {batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_AGGR ,1 ); +batadv_tvlv_handler_unregister2 (bat_priv,BATADV_OGM2 ,BATADV_TVLV_AGGR , +1 ); +batadv_tvlv_handler_unregister2 (bat_priv,BATADV_IV_OGM , +BATADV_TVLV_AGGR ,1 );batadv_tvlv_handler_unregister2 (bat_priv,BATADV_BCAST_AGGR ,BATADV_TVLV_ANY ,1 ); }
net/batman-adv/aggregation.h +31 -0
@@ -27,6 +27,14 @@ struct sk_buff;void batadv_aggr_add_counter_rx (struct batadv_priv *bat_priv,struct sk_buff *skb); +void batadv_aggr_hardif_start (struct batadv_hard_iface *hard_iface); +void batadv_aggr_hardif_stop (struct batadv_hard_iface *hard_iface); + +int batadv_aggr_queue (struct sk_buff *skb, +struct batadv_hard_iface *hard_iface); + +void batadv_aggr_purge_orig (struct batadv_orig_node *orig); +void batadv_aggr_hardif_init (struct batadv_hard_iface *hard_iface);int batadv_aggr_mesh_init (struct batadv_priv *bat_priv);void batadv_aggr_mesh_free (struct batadv_priv *bat_priv);
@@ -37,6 +45,29 @@ static inline void batadv_aggr_add_counter_rx(struct batadv_priv *bat_priv, { } +static inline void +batadv_aggr_hardif_start (struct batadv_hard_iface *hard_iface) +{ +} + +static inline void batadv_aggr_hardif_stop (struct batadv_hard_iface *hard_iface) +{ +} + +static inline int batadv_aggr_queue (struct sk_buff *skb, +struct batadv_hard_iface *hard_iface) +{ +return NET_XMIT_DROP ; +} + +static inline void batadv_aggr_purge_orig (struct batadv_orig_node *orig) +{ +} + +static inline void batadv_aggr_hardif_init (struct batadv_hard_iface *hard_iface) +{ +} +static inline int batadv_aggr_mesh_init (struct batadv_priv *bat_priv) {return 0 ;
net/batman-adv/bat_iv_ogm.c +3 -3
@@ -684,7 +684,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,unsigned int skb_size;atomic_t *queue_left = own_packet ?NULL : &bat_priv->batman_queue_left; -if (atomic_read (&bat_priv->aggregated_ogms) && +if (atomic_read (&bat_priv->aggregation) && packet_len <BATADV_MAX_AGGREGATION_BYTES ) skb_size =BATADV_MAX_AGGREGATION_BYTES ;else
@@ -777,7 +777,7 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,/* find position for the packet in the forward queue */ spin_lock_bh (&bat_priv->forw_bat_list_lock);/* own packets are not to be aggregated */ -if (atomic_read (&bat_priv->aggregated_ogms) && !own_packet) { +if (atomic_read (&bat_priv->aggregation) && !own_packet) {hlist_for_each_entry (forw_packet_pos, &bat_priv->forw_bat_list, list) { if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet,
@@ -803,7 +803,7 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,* we hold it back for a while, so that it might be aggregated * later on */ -if (!own_packet &&atomic_read (&bat_priv->aggregated_ogms)) +if (!own_packet &&atomic_read (&bat_priv->aggregation)) send_time += max_aggregation_jiffies; batadv_iv_ogm_aggregate_new(packet_buff, packet_len,
net/batman-adv/hard-interface.c +5 -0
@@ -38,6 +38,7 @@#include <net/net_namespace.h> #include <net/rtnetlink.h> +#include "aggregation.h" #include "bat_v.h" #include "bridge_loop_avoidance.h" #include "debugfs.h"
@@ -746,6 +747,8 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,if (ret <0 ) goto err_upper; +batadv_aggr_hardif_start (hard_iface); + hard_iface->if_num = bat_priv->num_ifaces; bat_priv->num_ifaces++; hard_iface->if_status =BATADV_IF_INACTIVE ;
@@ -832,6 +835,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,batadv_hardif_put (new_if); } +batadv_aggr_hardif_stop (hard_iface); bat_priv->algo_ops->iface.disable (hard_iface); hard_iface->if_status =BATADV_IF_NOT_IN_USE ;
@@ -901,6 +905,7 @@ batadv_hardif_add_interface(struct net_device *net_dev) hard_iface->num_bcasts =BATADV_NUM_BCASTS_WIRELESS ;batadv_v_hardif_init (hard_iface); +batadv_aggr_hardif_init (hard_iface);batadv_check_known_mac_addr (hard_iface->net_dev);kref_get (&hard_iface->refcount);
net/batman-adv/main.c +10 -0
@@ -349,6 +349,16 @@ int batadv_max_header_len(void) header_len =max_t (int, header_len,sizeof (struct batadv_coded_packet ));#endif +#ifdef CONFIG_BATMAN_ADV_AGGR + header_len =max_t (int, header_len, +sizeof (struct batadv_aggr_packet ) + +sizeof (struct batadv_tvlv_hdr ) + +sizeof (struct batadv_bcast_packet ) - +sizeof (((struct batadv_bcast_packet *)0 ) + ->packet_type) - +sizeof (((struct batadv_bcast_packet *)0 ) + ->version)); +#endif return header_len +ETH_HLEN ; }
net/batman-adv/main.h +1 -0
@@ -148,6 +148,7 @@ enum batadv_mesh_state {#define BATADV_BCAST_QUEUE_LEN 256#define BATADV_BATMAN_QUEUE_LEN 256 +#define BATADV_AGGR_QUEUE_LEN 512enum batadv_uev_action {BATADV_UEV_ADD =0 ,
net/batman-adv/originator.c +2 -0
@@ -38,6 +38,7 @@#include <net/sock.h> #include <uapi/linux/batman_adv.h> +#include "aggregation.h" #include "bat_algo.h" #include "distributed-arp-table.h" #include "fragmentation.h"
@@ -857,6 +858,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)batadv_mcast_purge_orig (orig_node);batadv_frag_purge_orig (orig_node,NULL ); +batadv_aggr_purge_orig (orig_node);if (orig_node->bat_priv->algo_ops->orig.free) orig_node->bat_priv->algo_ops->orig.free (orig_node);
net/batman-adv/send.c +9 -0
@@ -40,6 +40,7 @@#include <linux/stddef.h> #include <linux/workqueue.h> +#include "aggregation.h" #include "distributed-arp-table.h" #include "fragmentation.h" #include "gateway_client.h"
@@ -126,6 +127,14 @@ int batadv_send_skb_packet(struct sk_buff *skb,int batadv_send_broadcast_skb (struct sk_buff *skb,struct batadv_hard_iface *hard_iface) { +int ret; + +skb_reset_network_header (skb); + + ret =batadv_aggr_queue (skb, hard_iface); +if (ret ==NET_XMIT_SUCCESS ) +return ret; +return batadv_send_skb_packet (skb, hard_iface, batadv_broadcast_addr); }
net/batman-adv/soft-interface.c +10 -1
@@ -779,7 +779,10 @@ static int batadv_softif_init_late(struct net_device *dev)if (!bat_priv->bat_counters)return -ENOMEM ; -atomic_set (&bat_priv->aggregated_ogms,1 ); +atomic_set (&bat_priv->aggregation,1 ); +#ifdef CONFIG_BATMAN_ADV_AGGR +atomic_set (&bat_priv->aggr_num_disabled,0 ); +#endif atomic_set (&bat_priv->bonding,0 );#ifdef CONFIG_BATMAN_ADV_BLA atomic_set (&bat_priv->bridge_loop_avoidance,1 );
@@ -962,10 +965,16 @@ static const struct { { "frag_fwd" }, { "frag_fwd_bytes" }, #ifdef CONFIG_BATMAN_ADV_AGGR + { "aggr_tx" }, + { "aggr_tx_bytes" }, { "aggr_rx" }, { "aggr_rx_bytes" }, + { "aggr_parts_tx" }, + { "aggr_parts_tx_bytes" }, { "aggr_parts_rx" }, { "aggr_parts_rx_bytes" }, + { "aggr_queue_full" }, + { "aggr_urgent" }, #endif { "tt_request_tx" }, { "tt_request_rx" },
net/batman-adv/sysfs.c +4 -1
@@ -665,7 +665,9 @@ static ssize_t batadv_store_isolation_mark(struct kobject *kobj,return count; } -BATADV_ATTR_SIF_BOOL (aggregated_ogms,0644 ,NULL ); +BATADV_ATTR_SIF_BOOL (aggregation,0644 ,NULL ); +static BATADV_ATTR(aggregated_ogms, 0644, batadv_show_aggregation, + batadv_store_aggregation);BATADV_ATTR_SIF_BOOL (bonding,0644 ,NULL );#ifdef CONFIG_BATMAN_ADV_BLA BATADV_ATTR_SIF_BOOL (bridge_loop_avoidance,0644 , batadv_bla_status_update);
@@ -698,6 +700,7 @@ static BATADV_ATTR(isolation_mark, 0644, batadv_show_isolation_mark,static struct batadv_attribute *batadv_mesh_attrs[] = { &batadv_attr_aggregated_ogms, + &batadv_attr_aggregation, &batadv_attr_bonding, #ifdef CONFIG_BATMAN_ADV_BLA &batadv_attr_bridge_loop_avoidance,
net/batman-adv/types.h +40 -2
104 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 5/5 batman-adv: do not aggregate rebroadcasts in the same packet
In reply to Linus LüssingWith this patch, aggregating a broadcast packet multiple times into the same aggregation packet is avoided. Otherwise such aggregation would defeat the purpose of retransmissions (i.e. increasing reliability).
Instead packets which are supposed to be retransmitted are just put back into the aggregation queue and will be part of the next aggregation packet again.
--- net/batman-adv/aggregation.c | 69 +++++++++++++++++++++++++++++++++++--------- net/batman-adv/bat_iv_ogm.c | 3 +- net/batman-adv/send.c | 66 +++++++++++++++++++++++++++++++++++------- net/batman-adv/send.h | 8 ++++- net/batman-adv/types.h | 3 ++ 5 files changed, 124 insertions(+), 25 deletions(-)
net/batman-adv/aggregation.c +56 -13
@@ -253,7 +253,41 @@ batadv_aggr_queue_is_full(struct batadv_hard_iface *hard_iface) }/** +* batadv_aggr_queue_tail - add packet to tail of an aggregation queue +* @skb: the packet to queue +* @hard_iface: the interface to queue on +* +* Tries to add a broadcast packet to an aggregation queue. This might fail if +* the queue has no more free slots available. In that case, the caller needs to +* take care of freeing the skb. +* +* Return: True on successful queueing, false otherwise. +*/ +static bool batadv_aggr_queue_tail (struct sk_buff *skb, +struct batadv_hard_iface *hard_iface) +{ +struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); +bool ret = true; + +spin_lock_bh (&hard_iface->aggr.aggr_list_lock); +if (batadv_aggr_queue_is_full (hard_iface)) { +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_QUEUE_FULL ); + ret = false; + }else { +batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX ); +batadv_add_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX_BYTES , + skb->len +ETH_HLEN ); + +skb_queue_tail (&hard_iface->aggr.aggr_list, skb); + } +spin_unlock_bh (&hard_iface->aggr.aggr_list_lock); + +return ret; +} + +/** * batadv_aggr_squash_chunk - squash packets into an aggregate +* @hard_iface: the interface to potentially requeue on * @head: a list of to be squashed packets * @size: the size of the to be created aggregation packet * (excluding the ethernet header)
@@ -261,11 +295,14 @@ batadv_aggr_queue_is_full(struct batadv_hard_iface *hard_iface)* Allocates an aggregation packet and squashes the provided list of broadcast * packets into it. The provided list of packets is freed/consumed. * +* Batman broadcast packets are potentially requeued. +* * Return: An aggregation packet ready for transmission on success, NULL * otherwise. */ static struct sk_buff * -batadv_aggr_squash_chunk (struct sk_buff_head *head, +batadv_aggr_squash_chunk (struct batadv_hard_iface *hard_iface, +struct sk_buff_head *head,int size) {struct sk_buff *skb, *skb_tmp, *skb_aggr;
@@ -296,7 +333,15 @@ batadv_aggr_squash_chunk(struct sk_buff_head *head, to =skb_put (skb_aggr, len);skb_copy_bits (skb, offset, to, len);skb_unlink (skb, head); -consume_skb (skb); + +batadv_send_bcasts_inc (skb); + +if (batadv_send_bcasts_left (skb, hard_iface)) { +if (!batadv_aggr_queue_tail (skb, hard_iface)) +kfree_skb (skb); + }else { +consume_skb (skb); + } tvlv_len += len +sizeof (struct batadv_tvlv_hdr ); }
@@ -345,7 +390,7 @@ static bool batadv_aggr_send_chunk(struct batadv_hard_iface *hard_iface)skb_queue_head_init (&head); emptied =batadv_aggr_get_chunk (hard_iface, &head, &size); - skb =batadv_aggr_squash_chunk (&head, size); + skb =batadv_aggr_squash_chunk (hard_iface, &head, size);if (!skb) goto out;
@@ -394,6 +439,7 @@ static void batadv_aggr_work(struct work_struct *work)int batadv_aggr_queue (struct sk_buff *skb,struct batadv_hard_iface *hard_iface) {struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); +int ret;if (!atomic_read (&bat_priv->aggregation))return NET_XMIT_DROP ;
@@ -401,18 +447,15 @@ int batadv_aggr_queue(struct sk_buff *skb, struct batadv_hard_iface *hard_iface)if (atomic_read (&bat_priv->aggr_num_disabled))return NET_XMIT_DROP ; -if (batadv_aggr_queue_is_full (hard_iface)) { -batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_QUEUE_FULL ); -return NET_XMIT_DROP ; +/* we handle rebroadcasts here instead of the forw_packet API */ +if (batadv_send_is_rebroadcast (skb)) { +consume_skb (skb); +return NET_XMIT_SUCCESS ; } -spin_lock_bh (&hard_iface->aggr.aggr_list_lock); -skb_queue_tail (&hard_iface->aggr.aggr_list, skb); -spin_unlock_bh (&hard_iface->aggr.aggr_list_lock); - -batadv_inc_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX ); -batadv_add_counter (bat_priv,BATADV_CNT_AGGR_PARTS_TX_BYTES , - skb->len +ETH_HLEN ); + ret =batadv_aggr_queue_tail (skb, hard_iface); +if (!ret) +return NET_XMIT_DROP ;return NET_XMIT_SUCCESS ; }
net/batman-adv/bat_iv_ogm.c +2 -1
@@ -697,7 +697,8 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,return ; forw_packet_aggr =batadv_forw_packet_alloc (if_incoming, if_outgoing, - queue_left, bat_priv, skb); + queue_left, bat_priv, skb, + false);if (!forw_packet_aggr) {kfree_skb (skb);return ;
net/batman-adv/send.c +56 -10
121 lines not on this page · raw message
net/batman-adv/send.h +7 -1
@@ -35,13 +35,19 @@ batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming,struct batadv_hard_iface *if_outgoing, atomic_t *queue_left, struct batadv_priv *bat_priv, - struct sk_buff *skb); + struct sk_buff *skb, + bool resend);bool batadv_forw_packet_steal (struct batadv_forw_packet *packet,spinlock_t *l);void batadv_forw_packet_ogmv1_queue (struct batadv_priv *bat_priv,struct batadv_forw_packet *forw_packet,unsigned long send_time);bool batadv_forw_packet_is_rebroadcast (struct batadv_forw_packet *forw_packet); +bool batadv_send_bcasts_left (struct sk_buff *skb, +struct batadv_hard_iface *hard_iface); +void batadv_send_bcasts_inc (struct sk_buff *skb); +bool batadv_send_is_rebroadcast (struct sk_buff *skb); +int batadv_send_skb_to_orig (struct sk_buff *skb,struct batadv_orig_node *orig_node,struct batadv_hard_iface *recv_if);
net/batman-adv/types.h +3 -0
@@ -1424,10 +1424,13 @@ struct batadv_nc_packet {* @decoded: Marks a skb as decoded, which is checked when searching for coding * opportunities in network-coding.c * @num_bcasts: Counter for broadcast packet retransmissions +* @resend: Whether this packet should be transmitted more than once on wireless +* interfaces */ struct batadv_skb_cb {bool decoded;unsigned int num_bcasts; +bool resend; };/**
Signature · 1 line
2.1.4
v3 cover batman-adv: broadcast packet aggregation
In reply to Linus LüssingHrm, forgot to set the subject in the git-send-email-compose message...
Here you go :).