Skip to contentSkip to conversation

rtase: Add ndo_setup_tc support for CBS offload in traffic control setup

PATCH Applied Justin Lai 2 participants 2 messages Apr 16, 2025 – Apr 23, 2025

Subsystems (3)
lore
Share & tools
lore

Justin Lai

author maintainer
#0 lore raw

PATCH v4 1/1 rtase: Add ndo_setup_tc support for CBS offload in traffic control setup

Add support for ndo_setup_tc to enable CBS offload functionality as part of traffic control configuration for network devices, where CBS is applied from the CPU to the switch. More specifically, CBS is applied at the GMAC in the topmost architecture diagram.

---
v1 -> v2:
- Add a check to ensure that qopt->queue is within the specified range.
- Add a check for qopt->enable and handle it appropriately.

v2 -> v3:
- Nothing has changed, and it is simply being posted again now that net-next has reopened.

v3 -> v4
- Modify the commit message to include a description of the location where CBS is applied.

---
 drivers/net/ethernet/realtek/rtase/rtase.h    | 15 +++++
 .../net/ethernet/realtek/rtase/rtase_main.c   | 60 +++++++++++++++++++
 2 files changed, 75 insertions(+)
drivers/net/ethernet/realtek/rtase/rtase.h +15 -0
index 2bbfcad613ab..498cfe4d0cac 100644
@@ -170,6 +170,7 @@ enum rtase_registers {
 #define RTASE_TC_MODE_MASK GENMASK(11, 10)
 
 	RTASE_TOKSEL      = 0x2046,
+	RTASE_TXQCRDT_0   = 0x2500,
 	RTASE_RFIFONFULL  = 0x4406,
 	RTASE_INT_MITI_TX = 0x0A00,
 	RTASE_INT_MITI_RX = 0x0A80,
@@ -259,6 +260,12 @@ union rtase_rx_desc {
 #define RTASE_VLAN_TAG_MASK     GENMASK(15, 0)
 #define RTASE_RX_PKT_SIZE_MASK  GENMASK(13, 0)
 
+/* txqos hardware definitions */
+#define RTASE_1T_CLOCK            64
+#define RTASE_1T_POWER            10000000
+#define RTASE_IDLESLOPE_INT_SHIFT 25
+#define RTASE_IDLESLOPE_INT_MASK  GENMASK(31, 25)
+
 #define RTASE_IVEC_NAME_SIZE (IFNAMSIZ + 10)
 
 struct rtase_int_vector {
@@ -294,6 +301,13 @@ struct rtase_ring {
 	u64 alloc_fail;
 };
 
+struct rtase_txqos {
+	int hicredit;
+	int locredit;
+	int idleslope;
+	int sendslope;
+};
+
 struct rtase_stats {
 	u64 tx_dropped;
 	u64 rx_dropped;
@@ -313,6 +327,7 @@ struct rtase_private {
 
 	struct page_pool *page_pool;
 	struct rtase_ring tx_ring[RTASE_NUM_TX_QUEUE];
+	struct rtase_txqos tx_qos[RTASE_NUM_TX_QUEUE];
 	struct rtase_ring rx_ring[RTASE_NUM_RX_QUEUE];
 	struct rtase_counters *tally_vaddr;
 	dma_addr_t tally_paddr;
drivers/net/ethernet/realtek/rtase/rtase_main.c +60 -0

72 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 4 lines · On Wed, 16 Apr 2025 19:57:57 +0800 Justin Lai wrote:

Add support for ndo_setup_tc to enable CBS offload functionality as part of traffic control configuration for network devices, where CBS is applied from the CPU to the switch. More specifically, CBS is applied at the GMAC in the topmost architecture diagram.

Applied, thanks!