diff options
Diffstat (limited to 'net/batman-adv/send.c')
-rw-r--r-- | net/batman-adv/send.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 67c1c6c22f3b..3b4b2daa3b3e 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -32,7 +32,8 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work); | |||
32 | /* send out an already prepared packet to the given address via the | 32 | /* send out an already prepared packet to the given address via the |
33 | * specified batman interface | 33 | * specified batman interface |
34 | */ | 34 | */ |
35 | int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, | 35 | int batadv_send_skb_packet(struct sk_buff *skb, |
36 | struct batadv_hard_iface *hard_iface, | ||
36 | const uint8_t *dst_addr) | 37 | const uint8_t *dst_addr) |
37 | { | 38 | { |
38 | struct ethhdr *ethhdr; | 39 | struct ethhdr *ethhdr; |
@@ -76,9 +77,9 @@ send_skb_err: | |||
76 | return NET_XMIT_DROP; | 77 | return NET_XMIT_DROP; |
77 | } | 78 | } |
78 | 79 | ||
79 | void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) | 80 | void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface) |
80 | { | 81 | { |
81 | struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | 82 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); |
82 | 83 | ||
83 | if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) || | 84 | if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) || |
84 | (hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)) | 85 | (hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)) |
@@ -96,7 +97,7 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) | |||
96 | bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface); | 97 | bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface); |
97 | } | 98 | } |
98 | 99 | ||
99 | static void batadv_forw_packet_free(struct forw_packet *forw_packet) | 100 | static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet) |
100 | { | 101 | { |
101 | if (forw_packet->skb) | 102 | if (forw_packet->skb) |
102 | kfree_skb(forw_packet->skb); | 103 | kfree_skb(forw_packet->skb); |
@@ -105,9 +106,10 @@ static void batadv_forw_packet_free(struct forw_packet *forw_packet) | |||
105 | kfree(forw_packet); | 106 | kfree(forw_packet); |
106 | } | 107 | } |
107 | 108 | ||
108 | static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | 109 | static void |
109 | struct forw_packet *forw_packet, | 110 | _batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, |
110 | unsigned long send_time) | 111 | struct batadv_forw_packet *forw_packet, |
112 | unsigned long send_time) | ||
111 | { | 113 | { |
112 | INIT_HLIST_NODE(&forw_packet->list); | 114 | INIT_HLIST_NODE(&forw_packet->list); |
113 | 115 | ||
@@ -132,12 +134,12 @@ static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
132 | * The skb is not consumed, so the caller should make sure that the | 134 | * The skb is not consumed, so the caller should make sure that the |
133 | * skb is freed. | 135 | * skb is freed. |
134 | */ | 136 | */ |
135 | int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | 137 | int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, |
136 | const struct sk_buff *skb, | 138 | const struct sk_buff *skb, |
137 | unsigned long delay) | 139 | unsigned long delay) |
138 | { | 140 | { |
139 | struct hard_iface *primary_if = NULL; | 141 | struct batadv_hard_iface *primary_if = NULL; |
140 | struct forw_packet *forw_packet; | 142 | struct batadv_forw_packet *forw_packet; |
141 | struct batadv_bcast_packet *bcast_packet; | 143 | struct batadv_bcast_packet *bcast_packet; |
142 | struct sk_buff *newskb; | 144 | struct sk_buff *newskb; |
143 | 145 | ||
@@ -187,14 +189,18 @@ out: | |||
187 | 189 | ||
188 | static void batadv_send_outstanding_bcast_packet(struct work_struct *work) | 190 | static void batadv_send_outstanding_bcast_packet(struct work_struct *work) |
189 | { | 191 | { |
190 | struct hard_iface *hard_iface; | 192 | struct batadv_hard_iface *hard_iface; |
191 | struct delayed_work *delayed_work = | 193 | struct delayed_work *delayed_work = |
192 | container_of(work, struct delayed_work, work); | 194 | container_of(work, struct delayed_work, work); |
193 | struct forw_packet *forw_packet = | 195 | struct batadv_forw_packet *forw_packet; |
194 | container_of(delayed_work, struct forw_packet, delayed_work); | ||
195 | struct sk_buff *skb1; | 196 | struct sk_buff *skb1; |
196 | struct net_device *soft_iface = forw_packet->if_incoming->soft_iface; | 197 | struct net_device *soft_iface; |
197 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 198 | struct batadv_priv *bat_priv; |
199 | |||
200 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, | ||
201 | delayed_work); | ||
202 | soft_iface = forw_packet->if_incoming->soft_iface; | ||
203 | bat_priv = netdev_priv(soft_iface); | ||
198 | 204 | ||
199 | spin_lock_bh(&bat_priv->forw_bcast_list_lock); | 205 | spin_lock_bh(&bat_priv->forw_bcast_list_lock); |
200 | hlist_del(&forw_packet->list); | 206 | hlist_del(&forw_packet->list); |
@@ -235,10 +241,11 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) | |||
235 | { | 241 | { |
236 | struct delayed_work *delayed_work = | 242 | struct delayed_work *delayed_work = |
237 | container_of(work, struct delayed_work, work); | 243 | container_of(work, struct delayed_work, work); |
238 | struct forw_packet *forw_packet = | 244 | struct batadv_forw_packet *forw_packet; |
239 | container_of(delayed_work, struct forw_packet, delayed_work); | 245 | struct batadv_priv *bat_priv; |
240 | struct bat_priv *bat_priv; | ||
241 | 246 | ||
247 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, | ||
248 | delayed_work); | ||
242 | bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); | 249 | bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); |
243 | spin_lock_bh(&bat_priv->forw_bat_list_lock); | 250 | spin_lock_bh(&bat_priv->forw_bat_list_lock); |
244 | hlist_del(&forw_packet->list); | 251 | hlist_del(&forw_packet->list); |
@@ -264,10 +271,11 @@ out: | |||
264 | batadv_forw_packet_free(forw_packet); | 271 | batadv_forw_packet_free(forw_packet); |
265 | } | 272 | } |
266 | 273 | ||
267 | void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | 274 | void |
268 | const struct hard_iface *hard_iface) | 275 | batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, |
276 | const struct batadv_hard_iface *hard_iface) | ||
269 | { | 277 | { |
270 | struct forw_packet *forw_packet; | 278 | struct batadv_forw_packet *forw_packet; |
271 | struct hlist_node *tmp_node, *safe_tmp_node; | 279 | struct hlist_node *tmp_node, *safe_tmp_node; |
272 | bool pending; | 280 | bool pending; |
273 | 281 | ||