aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/send.h
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@web.de>2013-07-03 04:40:00 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-19 11:31:54 -0400
commite300d314664ef6746e697d5b581f85114ab1f843 (patch)
tree8496c328c2590f0ca0cf91a1325794fe2c0d44d4 /net/batman-adv/send.h
parentb8cbd81d0944cd2dc097b2b4ae8adaf639c5b4df (diff)
batman-adv: refine API calls for unicast transmissions of SKBs
With this patch the functions batadv_send_skb_unicast() and batadv_send_skb_unicast_4addr() are further refined into batadv_send_skb_via_tt(), batadv_send_skb_via_tt_4addr() and batadv_send_skb_via_gw(). This way we avoid any "guessing" about where to send a packet in the unicast forwarding methods and let the callers decide. This is going to be useful for the upcoming multicast related patches in particular. Further, the return values were polished a little to use the more appropriate NET_XMIT_* defines. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Acked-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/send.h')
-rw-r--r--net/batman-adv/send.h51
1 files changed, 30 insertions, 21 deletions
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h
index c030cb72ff45..aa2e2537a739 100644
--- a/net/batman-adv/send.h
+++ b/net/batman-adv/send.h
@@ -38,45 +38,54 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
38 struct sk_buff *skb, 38 struct sk_buff *skb,
39 struct batadv_orig_node *orig_node, 39 struct batadv_orig_node *orig_node,
40 int packet_subtype); 40 int packet_subtype);
41int batadv_send_skb_generic_unicast(struct batadv_priv *bat_priv, 41int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
42 struct sk_buff *skb, int packet_type, 42 struct sk_buff *skb, int packet_type,
43 int packet_subtype, 43 int packet_subtype, unsigned short vid);
44 unsigned short vid); 44int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
45 unsigned short vid);
45 46
46/** 47/**
47 * batadv_send_unicast_skb - send the skb encapsulated in a unicast packet 48 * batadv_send_skb_via_tt - send an skb via TT lookup
48 * @bat_priv: the bat priv with all the soft interface information 49 * @bat_priv: the bat priv with all the soft interface information
49 * @skb: the payload to send 50 * @skb: the payload to send
50 * @vid: the vid to be used to search the translation table 51 * @vid: the vid to be used to search the translation table
51 * 52 *
52 * Returns 1 in case of error or 0 otherwise. 53 * Look up the recipient node for the destination address in the ethernet
54 * header via the translation table. Wrap the given skb into a batman-adv
55 * unicast header. Then send this frame to the according destination node.
56 *
57 * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
53 */ 58 */
54static inline int batadv_send_skb_unicast(struct batadv_priv *bat_priv, 59static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
55 struct sk_buff *skb, 60 struct sk_buff *skb,
56 unsigned short vid) 61 unsigned short vid)
57{ 62{
58 return batadv_send_skb_generic_unicast(bat_priv, skb, BATADV_UNICAST, 63 return batadv_send_skb_via_tt_generic(bat_priv, skb, BATADV_UNICAST, 0,
59 0, vid); 64 vid);
60} 65}
61 66
62/** 67/**
63 * batadv_send_4addr_unicast_skb - send the skb encapsulated in a unicast 4addr 68 * batadv_send_skb_via_tt_4addr - send an skb via TT lookup
64 * packet
65 * @bat_priv: the bat priv with all the soft interface information 69 * @bat_priv: the bat priv with all the soft interface information
66 * @skb: the payload to send 70 * @skb: the payload to send
67 * @packet_subtype: the unicast 4addr packet subtype to use 71 * @packet_subtype: the unicast 4addr packet subtype to use
68 * @vid: the vid to be used to search the translation table 72 * @vid: the vid to be used to search the translation table
69 * 73 *
70 * Returns 1 in case of error or 0 otherwise. 74 * Look up the recipient node for the destination address in the ethernet
75 * header via the translation table. Wrap the given skb into a batman-adv
76 * unicast-4addr header. Then send this frame to the according destination
77 * node.
78 *
79 * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
71 */ 80 */
72static inline int batadv_send_skb_unicast_4addr(struct batadv_priv *bat_priv, 81static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv,
73 struct sk_buff *skb, 82 struct sk_buff *skb,
74 int packet_subtype, 83 int packet_subtype,
75 unsigned short vid) 84 unsigned short vid)
76{ 85{
77 return batadv_send_skb_generic_unicast(bat_priv, skb, 86 return batadv_send_skb_via_tt_generic(bat_priv, skb,
78 BATADV_UNICAST_4ADDR, 87 BATADV_UNICAST_4ADDR,
79 packet_subtype, vid); 88 packet_subtype, vid);
80} 89}
81 90
82#endif /* _NET_BATMAN_ADV_SEND_H_ */ 91#endif /* _NET_BATMAN_ADV_SEND_H_ */