mac80211: NSS classify tx support

This commit is contained in:
coolsnowwolf 2021-07-09 17:39:01 +08:00
parent ff90683203
commit 2513ccaf94
3 changed files with 65 additions and 6688 deletions

View File

@ -0,0 +1,45 @@
--- 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 <net/ip.h>
+#include <net/dsfield.h>
+#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;

View File

@ -0,0 +1,20 @@
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1580,7 +1580,16 @@ static bool ieee80211_tx_frags(struct ie
return true;
}
} else {
-
+#ifdef CPTCFG_MAC80211_NSS_SUPPORT
+ if (skb_queue_len(&local->pending[q]) >= 1000) {
+ spin_unlock_irqrestore(
+ &local->queue_stop_reason_lock,
+ flags);
+ ieee80211_purge_tx_queue(&local->hw,
+ skbs);
+ return false;
+ }
+#endif
/*
* Since queue is stopped, queue up frames for
* later transmission from the tx-pending

File diff suppressed because it is too large Load Diff