Add TAPRIO offload support for ICSSG driver
Subsystems (3)
MD Danish Anwar
reviewerv7 cover Add TAPRIO offload support for ICSSG driver
This series adds taprio offload support for ICSSG driver.
Patch [1/2] of the series moves some structures and API definition to .h files so that these can be accessed by taprio (icssg_qos.c) file.
Patch [2/2] of the series intoduces the taprio support for icssg driver.
Changes from v6 to v7:
*) Rebased on 6.10-rc1.
*) Removed RFC tag, no functional changes.
Changes from v5 to v6:
*) Added RFC tag as net-next is closed now.
*) Created a new patch for "the struct definition move" and made this
series instead of single patch as suggested by
Paolo Abeni <[email protected]>.
*) Removed est_new structure as that is no longer used.
*) Freeing qos.tas.taprio_admin using taprio_offload_free() as suggested
by Paolo Abeni <[email protected]>
*) Clearing taprio_admin and taprio in error case in emac_taprio_replace()
API using goto label taprio_clear.
*) Added RB tag of Simon Horman <[email protected]>
Changes from v4 to v5:
*) Rebased on latest net-next/main [commit 5c4c0edca68a]
*) Moved icss_iep structure to icss_iep.h file so that iep wraparound time
which is stored in iep->def_inc, can be accessed by qos file.
*) Added comment about IEP wraparound time compensation in icssg_qos.c *) Moved icssg_qos_tas_init() to prueth_netdev_init() so that icssg_qos_tas_init()
gets called even if interface is down.
*) Fixed print statements as suggested by Vladimir Oltean <[email protected]> *) Added taprio_offload_get() and taprio_offload_free() in emac_taprio_replace()
and emac_taprio_destory() respectively.
Changes from v3 to v4:
*) Rebased on the latest next-20231005 linux-next.
*) Addressed Roger and Vinicius' comments and moved all the validations to
emac_taprio_replace() API.
*) Modified emac_setup_taprio() API to use switch case based on taprio->cmd
and added emac_taprio_destroy() and emac_taprio_replace() APIs.
*) Modified the documentation of structs / enums in icssg_qos.h by using
the correct kdoc format.
Changes from v2 to v3:
*) Rebased on the latest next-20230928 linux-next.
*) Retained original authorship of the patch.
*) Addressed Roger's comments and modified emac_setup_taprio() and
emac_set_taprio() APIs accordingly.
*) Removed netif_running() check from emac_setup_taprio().
*) Addressed Vinicius' comments and added check for MIN and MAX cycle time. *) Added check for allocation failure of est_new in emac_setup_taprio().
Changes from v1 to v2:
*) Rebased on the latest next-20230921 linux-next. *) Dropped the RFC tag as merge window is open now. *) Splitted this patch from the switch mode series [v1]. *) Removed TODO comment as asked by Andrew and Roger. *) Changed Copyright to 2023 as asked by Roger.
v6: https://lore.kernel.org/all/[email protected]/
v5: https://lore.kernel.org/all/[email protected]/
v4: https://lore.kernel.org/all/[email protected]/
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
MD Danish Anwar (1):
net: ti: icssg: Move icss_iep structure
Roger Quadros (1):
net: ti: icssg_prueth: add TAPRIO offload support
drivers/net/ethernet/ti/Kconfig | 1 + drivers/net/ethernet/ti/Makefile | 3 +- drivers/net/ethernet/ti/icssg/icss_iep.c | 72 ----- drivers/net/ethernet/ti/icssg/icss_iep.h | 73 ++++- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 5 +- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 5 + drivers/net/ethernet/ti/icssg/icssg_qos.c | 288 +++++++++++++++++++ drivers/net/ethernet/ti/icssg/icssg_qos.h | 113 ++++++++ 8 files changed, 485 insertions(+), 75 deletions(-) create mode 100644 drivers/net/ethernet/ti/icssg/icssg_qos.c create mode 100644 drivers/net/ethernet/ti/icssg/icssg_qos.h
base-commit: 66ad4829ddd0b5540dc0b076ef2818e89c8f720e
Signature · 1 line
2.34.1
MD Danish Anwar
reviewerPATCH v7 1/2 net: ti: icssg: Move icss_iep structure
Move icss_iep structure definition and prueth_iep_gettime to icss_iep.h and icssg_prueth.h file respectively so that they can be used / accessed by all icssg driver files.
--- drivers/net/ethernet/ti/icssg/icss_iep.c | 72 ------------------- drivers/net/ethernet/ti/icssg/icss_iep.h | 73 +++++++++++++++++++- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 2 +- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 2 + 4 files changed, 75 insertions(+), 74 deletions(-)
drivers/net/ethernet/ti/icssg/icss_iep.c +0 -72
@@ -52,78 +52,6 @@#define IEP_CAP_CFG_CAPNR_1ST_EVENT_EN (n) BIT(LATCH_INDEX(n))#define IEP_CAP_CFG_CAP_ASYNC_EN (n) BIT(LATCH_INDEX(n) + 10) -enum { -ICSS_IEP_GLOBAL_CFG_REG , -ICSS_IEP_GLOBAL_STATUS_REG , -ICSS_IEP_COMPEN_REG , -ICSS_IEP_SLOW_COMPEN_REG , -ICSS_IEP_COUNT_REG0 , -ICSS_IEP_COUNT_REG1 , -ICSS_IEP_CAPTURE_CFG_REG , -ICSS_IEP_CAPTURE_STAT_REG , - -ICSS_IEP_CAP6_RISE_REG0 , -ICSS_IEP_CAP6_RISE_REG1 , - -ICSS_IEP_CAP7_RISE_REG0 , -ICSS_IEP_CAP7_RISE_REG1 , - -ICSS_IEP_CMP_CFG_REG , -ICSS_IEP_CMP_STAT_REG , -ICSS_IEP_CMP0_REG0 , -ICSS_IEP_CMP0_REG1 , -ICSS_IEP_CMP1_REG0 , -ICSS_IEP_CMP1_REG1 , - -ICSS_IEP_CMP8_REG0 , -ICSS_IEP_CMP8_REG1 , -ICSS_IEP_SYNC_CTRL_REG , -ICSS_IEP_SYNC0_STAT_REG , -ICSS_IEP_SYNC1_STAT_REG , -ICSS_IEP_SYNC_PWIDTH_REG , -ICSS_IEP_SYNC0_PERIOD_REG , -ICSS_IEP_SYNC1_DELAY_REG , -ICSS_IEP_SYNC_START_REG , -ICSS_IEP_MAX_REGS , -}; - -/** -* struct icss_iep_plat_data - Plat data to handle SoC variants -* @config: Regmap configuration data -* @reg_offs: register offsets to capture offset differences across SoCs -* @flags: Flags to represent IEP properties -*/ -struct icss_iep_plat_data { -struct regmap_config *config; -u32 reg_offs[ICSS_IEP_MAX_REGS ]; -u32 flags; -}; - -struct icss_iep { -struct device *dev; -void __iomem *base; -const struct icss_iep_plat_data *plat_data; -struct regmap *map; -struct device_node *client_np; -unsigned long refclk_freq; -int clk_tick_time;/* one refclk tick time in ns */ -struct ptp_clock_info ptp_info; -struct ptp_clock *ptp_clock; -struct mutex ptp_clk_mutex;/* PHC access serializer */ -spinlock_t irq_lock;/* CMP IRQ vs icss_iep_ptp_enable access */ -u32 def_inc; -s16 slow_cmp_inc; -u32 slow_cmp_count; -const struct icss_iep_clockops *ops; -void *clockops_data; -u32 cycle_time_ns; -u32 perout_enabled; -bool pps_enabled; -int cap_cmp_irq; -u64 period; -u32 latch_enable; -}; -/** * icss_iep_get_count_hi() - Get the upper 32 bit IEP counter * @iep: Pointer to structure representing IEP.
drivers/net/ethernet/ti/icssg/icss_iep.h +72 -1
79 lines not on this page · raw message
drivers/net/ethernet/ti/icssg/icssg_prueth.c +1 -1
@@ -284,7 +284,7 @@ static int emac_phy_connect(struct prueth_emac *emac)return 0 ; } -static u64 prueth_iep_gettime (void *clockops_data,struct ptp_system_timestamp *sts) +u64 prueth_iep_gettime (void *clockops_data,struct ptp_system_timestamp *sts) {u32 hi_rollover_count, hi_rollover_count_r;struct prueth_emac *emac = clockops_data;
drivers/net/ethernet/ti/icssg/icssg_prueth.h +2 -0
@@ -320,6 +320,8 @@ void emac_stats_work_handler(struct work_struct *work);void emac_update_hardware_stats (struct prueth_emac *emac);int emac_get_stat_by_name (struct prueth_emac *emac,char *stat_name); +u64 prueth_iep_gettime (void *clockops_data,struct ptp_system_timestamp *sts); +/* Common functions */ void prueth_cleanup_rx_chns(struct prueth_emac *emac, struct prueth_rx_chn *rx_chn,
Signature · 1 line
2.34.1
MD Danish Anwar
reviewerPATCH v7 2/2 net: ti: icssg_prueth: add TAPRIO offload support
In reply to MD Danish AnwarFrom: Roger Quadros <[email protected]>
ICSSG dual-emac f/w supports Enhanced Scheduled Traffic (EST – defined in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018) configuration. EST allows express queue traffic to be scheduled (placed) on the wire at specific repeatable time intervals. In Linux kernel, EST configuration is done through tc command and the taprio scheduler in the net core implements a software only scheduler (SCH_TAPRIO). If the NIC is capable of EST configuration, user indicate "flag 2" in the command which is then parsed by taprio scheduler in net core and indicate that the command is to be offloaded to h/w. taprio then offloads the command to the driver by calling ndo_setup_tc() ndo ops. This patch implements ndo_setup_tc() to offload EST configuration to ICSSG.
---
Cc: Roger Quadros <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Vinicius Costa Gomes <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Vladimir Oltean <[email protected]>
drivers/net/ethernet/ti/Kconfig | 1 + drivers/net/ethernet/ti/Makefile | 3 +- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 3 + drivers/net/ethernet/ti/icssg/icssg_prueth.h | 3 + drivers/net/ethernet/ti/icssg/icssg_qos.c | 288 +++++++++++++++++++ drivers/net/ethernet/ti/icssg/icssg_qos.h | 113 ++++++++ 6 files changed, 410 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/ti/icssg/icssg_qos.c create mode 100644 drivers/net/ethernet/ti/icssg/icssg_qos.h
drivers/net/ethernet/ti/Kconfig +1 -0
@@ -190,6 +190,7 @@ config TI_ICSSG_PRUETH depends on PRU_REMOTEPROC depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER depends on PTP_1588_CLOCK_OPTIONAL + depends on NET_SCH_TAPRIO help Support dual Gigabit Ethernet ports over the ICSSG PRU Subsystem. This subsystem is available starting with the AM65 platform.
drivers/net/ethernet/ti/Makefile +2 -1
@@ -39,7 +39,8 @@ icssg-prueth-y := icssg/icssg_prueth.o \ icssg/icssg_config.o \ icssg/icssg_mii_cfg.o \ icssg/icssg_stats.o \ - icssg/icssg_ethtool.o + icssg/icssg_ethtool.o \ + icssg/icssg_qos.o obj-$(CONFIG_TI_ICSSG_PRUETH_SR1) += icssg-prueth-sr1.o icssg-prueth-sr1-y := icssg/icssg_prueth_sr1.o \ icssg/icssg_common.o \
drivers/net/ethernet/ti/icssg/icssg_prueth.c +3 -0
@@ -685,6 +685,7 @@ static const struct net_device_ops emac_netdev_ops = { .ndo_eth_ioctl = emac_ndo_ioctl, .ndo_get_stats64 = emac_ndo_get_stats64, .ndo_get_phys_port_name = emac_ndo_get_phys_port_name, + .ndo_setup_tc = icssg_qos_ndo_setup_tc, }; static int prueth_netdev_init(struct prueth *prueth,
@@ -819,6 +820,8 @@ static int prueth_netdev_init(struct prueth *prueth, emac->rx_hrtimer.function = &emac_rx_timer_callback; prueth->emac[mac] = emac; +icssg_qos_tas_init (ndev); +return 0 ; free:
drivers/net/ethernet/ti/icssg/icssg_prueth.h +3 -0
@@ -37,6 +37,7 @@#include "icssg_config.h" #include "icss_iep.h" #include "icssg_switch_map.h" +#include "icssg_qos.h" #define PRUETH_MAX_MTU (2000 - ETH_HLEN - ETH_FCS_LEN)#define PRUETH_MIN_PKT_SIZE (VLAN_ETH_ZLEN)
@@ -186,6 +187,8 @@ struct prueth_emac {struct pruss_mem_region dram; +struct prueth_qos qos; +struct delayed_work stats_work;u64 stats[ICSSG_NUM_STATS ];
drivers/net/ethernet/ti/icssg/icssg_qos.c new file +288 -0
288 lines not on this page · raw message
drivers/net/ethernet/ti/icssg/icssg_qos.h new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next v7 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Quoted 5 lines · MD Danish Anwar
From: Roger Quadros <[email protected]>
ICSSG dual-emac f/w supports Enhanced Scheduled Traffic (EST – defined in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018) configuration.
You only mention dual-emac here. What about when it is in switch mode and is using the other firmware?
Andrew
MD Danish Anwar
reviewerRe: [PATCH net-next v7 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Quoted 10 lines · Andrew Lunn
Quoted 5 lines · MD Danish Anwar
From: Roger Quadros <[email protected]>
ICSSG dual-emac f/w supports Enhanced Scheduled Traffic (EST – defined in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018) configuration.
You only mention dual-emac here. What about when it is in switch mode and is using the other firmware?
Both dual-emac and switch firmware supports taprio. The implementation is same for both firmwares and there is no difference. The patch was developed before switch support and that's why the commit message only says dual-emac. I will update the commit message. Is there anything else that needs to be changed in this seires? If there is, please let me know. I will try to post it soon.
Quoted 1 line
Andrew
Signature · 7 lines
Thanks and Regards, Danish _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 6 lines · MD Danish Anwar
This series adds taprio offload support for ICSSG driver.
Patch [1/2] of the series moves some structures and API definition to .h files so that these can be accessed by taprio (
icssg_qos.c) file.Patch [2/2] of the series intoduces the taprio support for icssg driver.
What is the dependency between these patches and switchdev support? It is good to make that clear in the cover note, especially if this code will not apply without some other patches first.
Andrew
MD Danish Anwar
reviewerHi Andrew,
Quoted 12 lines · Andrew Lunn
Quoted 6 lines · MD Danish Anwar
This series adds taprio offload support for ICSSG driver.
Patch [1/2] of the series moves some structures and API definition to .h files so that these can be accessed by taprio (
icssg_qos.c) file.Patch [2/2] of the series intoduces the taprio support for icssg driver.
What is the dependency between these patches and switchdev support? It is good to make that clear in the cover note, especially if this code will not apply without some other patches first.
I have developed this patch and the switchdev series independently. Both series can be applied to latest net-next without any error. Once one of these gets applied I will rebase it on top of the other one. There is no dependency between switch and mac mode for taprio support.
Quoted 1 line
Andrew
Signature · 7 lines
Thanks and Regards, Danish _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel