mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-17 17:31:27 +00:00
103 lines
2.8 KiB
Diff
103 lines
2.8 KiB
Diff
From ad406560cdbdc4ffeca500a120fc3a9a495046b9 Mon Sep 17 00:00:00 2001
|
|
From: Subhash Kumar Katnapally <quic_skatnapa@quicinc.com>
|
|
Date: Tue, 26 Jul 2022 09:24:19 +0530
|
|
Subject: [PATCH 268/281] Add fast transmit API version for virtual port path
|
|
|
|
Removed additional checks not needed for VP Tx path such
|
|
as dst check. Non-linear packets are handled via dev_queue_xmit
|
|
path.
|
|
|
|
Change-Id: I80a55dd5ae17d31a1484c83e99015987cda38e1b
|
|
Signed-off-by: Subhash Kumar Katnapally <quic_skatnapa@quicinc.com>
|
|
---
|
|
include/linux/netdevice.h | 1 +
|
|
net/core/dev.c | 60 +++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 61 insertions(+)
|
|
|
|
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
|
|
index e41c64aca457..2168d9b62ace 100644
|
|
--- a/include/linux/netdevice.h
|
|
+++ b/include/linux/netdevice.h
|
|
@@ -3046,6 +3046,7 @@ static inline int dev_direct_xmit(struct sk_buff *skb, u16 queue_id)
|
|
return ret;
|
|
}
|
|
|
|
+bool dev_fast_xmit_vp(struct sk_buff *skb, struct net_device *dev);
|
|
bool dev_fast_xmit(struct sk_buff *skb, struct net_device *dev,
|
|
netdev_features_t features);
|
|
int register_netdevice(struct net_device *dev);
|
|
diff --git a/net/core/dev.c b/net/core/dev.c
|
|
index 151324a29ccd..17228feb5011 100644
|
|
--- a/net/core/dev.c
|
|
+++ b/net/core/dev.c
|
|
@@ -4146,6 +4146,66 @@ struct netdev_queue *netdev_core_pick_tx(struct net_device *dev,
|
|
return netdev_get_tx_queue(dev, queue_index);
|
|
}
|
|
|
|
+/**
|
|
+ * dev_fast_xmit_vp - fast xmit the skb to a PPE virtual port
|
|
+ * @skb:buffer to transmit
|
|
+ * @dev: the device to be transmited to
|
|
+ * sucessful return true
|
|
+ * failed return false
|
|
+ */
|
|
+bool dev_fast_xmit_vp(struct sk_buff *skb,
|
|
+ struct net_device *dev)
|
|
+{
|
|
+ struct netdev_queue *txq;
|
|
+ int cpu;
|
|
+ netdev_tx_t rc;
|
|
+
|
|
+ if (unlikely(!(dev->flags & IFF_UP))) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ if (unlikely(skb_is_nonlinear(skb))) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ rcu_read_lock_bh();
|
|
+ cpu = smp_processor_id();
|
|
+
|
|
+ /*
|
|
+ * TODO: Skip this altogether and eventually move this call to ppe_vp
|
|
+ * this would avoid multiple function calls when giving packet to wifi VAP.
|
|
+ */
|
|
+ txq = netdev_core_pick_tx(dev, skb, NULL);
|
|
+
|
|
+ if (likely(txq->xmit_lock_owner != cpu)) {
|
|
+#define FAST_VP_HARD_TX_LOCK(txq, cpu) { \
|
|
+ __netif_tx_lock(txq, cpu); \
|
|
+}
|
|
+
|
|
+#define FAST_VP_HARD_TX_UNLOCK(txq) { \
|
|
+ __netif_tx_unlock(txq); \
|
|
+}
|
|
+ skb->fast_xmit = 1;
|
|
+ FAST_VP_HARD_TX_LOCK(txq, cpu);
|
|
+ if (likely(!netif_xmit_stopped(txq))) {
|
|
+ rc = netdev_start_xmit(skb, dev, txq, 0);
|
|
+ if (unlikely(!dev_xmit_complete(rc))) {
|
|
+ FAST_VP_HARD_TX_UNLOCK(txq);
|
|
+ goto q_xmit;
|
|
+ }
|
|
+ FAST_VP_HARD_TX_UNLOCK(txq);
|
|
+ rcu_read_unlock_bh();
|
|
+ return true;
|
|
+ }
|
|
+ FAST_VP_HARD_TX_UNLOCK(txq);
|
|
+ }
|
|
+q_xmit:
|
|
+ skb->fast_xmit = 0;
|
|
+ rcu_read_unlock_bh();
|
|
+ return false;
|
|
+}
|
|
+EXPORT_SYMBOL(dev_fast_xmit_vp);
|
|
+
|
|
/**
|
|
* dev_fast_xmit - fast xmit the skb
|
|
* @skb:buffer to transmit
|
|
--
|
|
2.17.1
|
|
|