29 Jul, 2017

2 commits

  • Trivial fix to spelling mistakes in batadv_dbg debug messages and
    also in a comment and ensure comment line is not wider than 80
    characters

    "ourselve" -> "ourselves"
    "surpressed" -> "suppressed"
    "troughput" -> "throughput"

    Signed-off-by: Colin Ian King
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Colin Ian King
     
  • skb_put_data makes it unnecessary to store the skb_put return value to copy
    some data to the packet. The returned pointer of skb_put_data should
    therefore not stored by functions which previously only used it to copy
    some data.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

16 Jun, 2017

1 commit

  • A common pattern with skb_put() is to just want to memcpy()
    some data into the new space, introduce skb_put_data() for
    this.

    An spatch similar to the one for skb_put_zero() converts many
    of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

    (again, manually post-processed to retain some comments)

    Reviewed-by: Stephen Hemminger
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

26 Jan, 2017

1 commit


09 Nov, 2016

1 commit


30 Oct, 2016

1 commit

  • With this patch, (re)broadcasting on a specific interfaces is avoided:

    * No neighbor: There is no need to broadcast on an interface if there
    is no node behind it.

    * Single neighbor is source: If there is just one neighbor on an
    interface and if this neighbor is the one we actually got this
    broadcast packet from, then we do not need to echo it back.

    * Single neighbor is originator: If there is just one neighbor on
    an interface and if this neighbor is the originator of this
    broadcast packet, then we do not need to echo it back.

    Goodies for BATMAN V:

    ("Upgrade your BATMAN IV network to V now to get these for free!")

    Thanks to the split of OGMv1 into two packet types, OGMv2 and ELP
    that is, we can now apply the same optimizations stated above to OGMv2
    packets, too.

    Furthermore, with BATMAN V, rebroadcasts can be reduced in certain
    multi interface cases, too, where BATMAN IV cannot. This is thanks to
    the removal of the "secondary interface originator" concept in BATMAN V.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     

19 Oct, 2016

1 commit


09 Aug, 2016

1 commit

  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

04 Jul, 2016

1 commit

  • The routing API data structure contains several function
    pointers that can easily be grouped together based on the
    component they work with.

    Split the API in subobjects in order to improve definition readability.

    At the same time, remove the "bat_" prefix from the API object and
    its fields names. These are batman-adv private structs and there is no
    need to always prepend such prefix, which only makes function invocations
    much much longer.

    Signed-off-by: Antonio Quartulli
    Reviewed-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     

30 Jun, 2016

4 commits

  • There are several places in batman-adv which provide logging related
    functions. These should be grouped together in the log.* files to make them
    easier to find.

    Reported-by: Markus Pargmann
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The bat_algo functionality in main.c is mostly unrelated to the rest of the
    content. It still takes up a large portion of this source file (~15%, 103
    lines). Moving it to a separate file makes it better visible as a main
    component of the batman-adv implementation and hides it less in the other
    helper functions in main.c.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The tvlv functionality in main.c is mostly unrelated to the rest of the
    content. It still takes up a large portion of this source file (~45%, 588
    lines). Moving it to a separate file makes it better visible as a main
    component of the batman-adv implementation and hides it less in the other
    helper functions in main.c

    Signed-off-by: Markus Pargmann
    [sven@narfation.org: fix conflicts with current version, fix includes,
    rewrote commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Markus Pargmann
     
  • Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     

10 May, 2016

1 commit

  • The batadv_hardif_list list is checked in many situations and the items
    in this list are given to specialized functions to modify the routing
    behavior. At the moment each of these called functions has to check
    itself whether the received batadv_hard_iface has a refcount > 0 before
    it can increase the reference counter and use it in other objects.

    This can easily lead to problems because it is not easily visible where
    all callers of a function got the batadv_hard_iface object from and
    whether they already hold a valid reference.

    Checking the reference counter directly before calling a subfunction
    with a pointer from the batadv_hardif_list avoids this problem.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

04 May, 2016

2 commits


29 Feb, 2016

4 commits

  • In case of wireless interface retrieve the throughput by
    querying cfg80211. To perform this call a separate work
    must be scheduled because the function may sleep and this
    is not allowed within an RCU protected context (RCU in this
    case is used to iterate over all the neighbours).

    Use ethtool to retrieve information about an Ethernet link
    like HALF/FULL_DUPLEX and advertised bandwidth (e.g.
    100/10Mbps).

    The metric is updated each time a new ELP packet is sent,
    this way it is possible to timely react to a metric
    variation which can imply (for example) a neighbour
    disconnection.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • To enable ELP to send probing packets over wireless links
    only if needed, batman-adv must keep track of the last time
    it sent a unicast packet towards every neighbour.

    For this purpose a 2 main changes are introduced:
    1) a new member of the elp_neigh_node structure stores the
    last time a unicast packet was sent towards this neighbour;
    2) a wrapper function for sending unicast packets is
    implemented. This function will simply update the member
    describe din point 1) and then forward the packet to the
    real sending routine.

    Point 2) implies that any code-path leading to a unicast
    sending now has to use the new wrapper.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • Add the support for recognising new originators in the
    network and rebroadcast their OGMs.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • This is the initial implementation of the new OGM protocol
    (version 2). It has been designed to work on top of the
    newly added ELP.

    In the previous version the OGM protocol was used to both
    measure link qualities and flood the network with the metric
    information. In this version the protocol is in charge of
    the latter task only, leaving the former to ELP.

    This means being able to decouple the interval used by the
    neighbor discovery from the OGM broadcasting, which revealed
    to be costly in dense networks and needed to be relaxed so
    leading to a less responsive routing protocol.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli