--- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -38,6 +38,11 @@ #include "wme.h" #include "rate.h" +#ifdef CPTCFG_MAC80211_NSS_SUPPORT +#include +#include +#endif + /* misc utils */ static inline void ieee80211_tx_stats(struct net_device *dev, u32 len) @@ -3561,6 +3566,30 @@ void __ieee80211_subif_start_xmit(struct netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { +#ifdef CPTCFG_MAC80211_NSS_SUPPORT + /* Packets from NSS does not have valid protocol, priority and other + * network stack values. Derive required parameters (priority + * and network_header) from payload for QoS header. + * XXX: Here the assumption is that packet are in 802.3 format. + * As of now priority is handled only for IPv4 and IPv6. + */ + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + + if (sdata->nssctx && likely(!skb->protocol)) { + skb_set_network_header(skb, 14); + switch (((struct ethhdr *)skb->data)->h_proto) { + case htons(ETH_P_IP): + skb->priority = (ipv4_get_dsfield(ip_hdr(skb)) & + 0xfc) >> 5; + break; + case htons(ETH_P_IPV6): + skb->priority = (ipv6_get_dsfield(ipv6_hdr(skb)) & + 0xfc) >> 5; + break; + } + } +#endif + if (unlikely(ieee80211_multicast_to_unicast(skb, dev))) { struct sk_buff_head queue;