diff options
author | Simon Wunderlich <simon@open-mesh.com> | 2013-07-29 11:56:44 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2013-08-28 05:31:50 -0400 |
commit | c54f38c9aa22ff65ca9f4c1bdbf2a11d017205f3 (patch) | |
tree | e12190c69088c2fee771a49e94c5ab6619ec3817 /net/batman-adv/routing.c | |
parent | 5b2941b18dc5f60a5c14a5c15693f9c58b0dd922 (diff) |
batman-adv: set skb priority according to content
The skb priority field may help the wireless driver to choose the right
queue (e.g. WMM queues). This should be set in batman-adv, as this
information is only available here.
This patch adds support for IPv4/IPv6 DS fields and VLAN PCP. Note that
only VLAN PCP is used if a VLAN header is present. Also initially set
TC_PRIO_CONTROL only for self-generated packets, and keep the priority
set by higher layers.
Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 2f0bd3ffe6e8..0439395d7ba5 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -775,7 +775,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
775 | struct batadv_neigh_node *neigh_node = NULL; | 775 | struct batadv_neigh_node *neigh_node = NULL; |
776 | struct batadv_unicast_packet *unicast_packet; | 776 | struct batadv_unicast_packet *unicast_packet; |
777 | struct ethhdr *ethhdr = eth_hdr(skb); | 777 | struct ethhdr *ethhdr = eth_hdr(skb); |
778 | int res, ret = NET_RX_DROP; | 778 | int res, hdr_len, ret = NET_RX_DROP; |
779 | struct sk_buff *new_skb; | 779 | struct sk_buff *new_skb; |
780 | 780 | ||
781 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 781 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
@@ -835,6 +835,22 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
835 | /* decrement ttl */ | 835 | /* decrement ttl */ |
836 | unicast_packet->header.ttl--; | 836 | unicast_packet->header.ttl--; |
837 | 837 | ||
838 | switch (unicast_packet->header.packet_type) { | ||
839 | case BATADV_UNICAST_4ADDR: | ||
840 | hdr_len = sizeof(struct batadv_unicast_4addr_packet); | ||
841 | break; | ||
842 | case BATADV_UNICAST: | ||
843 | hdr_len = sizeof(struct batadv_unicast_packet); | ||
844 | break; | ||
845 | default: | ||
846 | /* other packet types not supported - yet */ | ||
847 | hdr_len = -1; | ||
848 | break; | ||
849 | } | ||
850 | |||
851 | if (hdr_len > 0) | ||
852 | batadv_skb_set_priority(skb, hdr_len); | ||
853 | |||
838 | res = batadv_send_skb_to_orig(skb, orig_node, recv_if); | 854 | res = batadv_send_skb_to_orig(skb, orig_node, recv_if); |
839 | 855 | ||
840 | /* translate transmit result into receive result */ | 856 | /* translate transmit result into receive result */ |
@@ -1193,6 +1209,8 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
1193 | if (batadv_bla_check_bcast_duplist(bat_priv, skb)) | 1209 | if (batadv_bla_check_bcast_duplist(bat_priv, skb)) |
1194 | goto out; | 1210 | goto out; |
1195 | 1211 | ||
1212 | batadv_skb_set_priority(skb, sizeof(struct batadv_bcast_packet)); | ||
1213 | |||
1196 | /* rebroadcast packet */ | 1214 | /* rebroadcast packet */ |
1197 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); | 1215 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); |
1198 | 1216 | ||