Add TAPRIO offload support for ICSSG driver
Subsystems (3)
MD Danish Anwar
reviewerv8 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 introduces the taprio support for icssg driver.
Changes from v7 to v8:
*) Modified commit message of patch 2/2 to state both ICSSG Switch and
dual-emac firmware supports taprio offload as pointed out by Andrew Lunn <[email protected]>
*) Rebased on latest net-next/main
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.
v7: https://lore.kernel.org/all/[email protected]/
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: 2942dfab630444d46aaa37fb7d629b620abbf6ba
Signature · 1 line
2.34.1
MD Danish Anwar
reviewerPATCH v8 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
Re: [PATCH net-next v8 1/2] net: ti: icssg: Move icss_iep structure
Quoted 7 lines · MD Danish Anwar
Move
icss_iepstructure definition andprueth_iep_gettimetoicss_iep.handicssg_prueth.hfile respectively so that they can be used / accessed by all icssg driver files.Reviewed-by Simon Horman <[email protected]>Signed-off-by MD Danish Anwar <[email protected]>---
This is a straight forward move, verified with --color-moved-lines after applying it locally.
MD Danish Anwar
reviewerPATCH v8 2/2 net: ti: icssg_prueth: add TAPRIO offload support
In reply to MD Danish AnwarFrom: Roger Quadros <[email protected]>
The ICSSG dual-emac / switch firmware 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.
--- 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 v8 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Quoted 14 lines · MD Danish Anwar
From: Roger Quadros <[email protected]>
The ICSSG dual-emac / switch firmware 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 callingndo_setup_tc()ndo ops. This patch implementsndo_setup_tc()to offload EST configuration to ICSSG.
Quoted 5 lines
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Vignesh Raghavendra <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by MD Danish Anwar <[email protected]>---
I tried to apply this series to review it. Unfortunately It no longer applies cleanly since it has textual conflicts with 972383aecf43 ("net:
ti: icssg-switch: Add switchdev based driver for ethernet switch support"), which was part of:
https://lore.kernel.org/netdev/[email protected]/
The conflict seemed easy enough to resolve, but I'm not sure if the prueth_qos structure would be placed optimally. I tried to build the driver to check what the placement should be and was unable to get things to compile.
Re: [PATCH net-next v8 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Hi Jacob,
Quoted 28 lines · Jacob Keller
Quoted 14 lines · MD Danish Anwar
From: Roger Quadros <[email protected]>
The ICSSG dual-emac / switch firmware 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 callingndo_setup_tc()ndo ops. This patch implementsndo_setup_tc()to offload EST configuration to ICSSG.Quoted 5 lines
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Vignesh Raghavendra <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by MD Danish Anwar <[email protected]>---
I tried to apply this series to review it. Unfortunately It no longer applies cleanly since it has textual conflicts with
972383aecf43("net:
ti: icssg-switch: Add switchdev based driver for ethernet switch support"), which was part of:
Quoted 6 lines
https://lore.kernel.org/netdev/[email protected]/
The conflict seemed easy enough to resolve, but I'm not sure if the
prueth_qosstructure would be placed optimally. I tried to build the driver to check what the placement should be and was unable to get things to compile.
When I had posted this series (v8) the ICSSG switch series was not merged yet and I had rebased this series on net-next/main. When you tested it, the ICSSG Series was merged and as it resulted in conflict.
I will rebase it on the latest net-next and make sure that their is no conflict and post next revision.
Thanks for your feedback.
Signature · 7 lines
Thanks and Regards, Md Danish Anwar _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH net-next v8 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Quoted 6 lines
When I had posted this series (v8) the ICSSG switch series was not merged yet and I had rebased this series on net-next/main. When you tested it, the ICSSG Series was merged and as it resulted in conflict.
I will rebase it on the latest net-next and make sure that their is no conflict and post next revision.
This is what i asked about, what are the build dependencies. Please always state them in the cover note.
In general, we recommend what when you have two or more patch series for a driver floating around, mark all but one RFC, so you get comments on them, but it is clear there is no need to try to apply them because of dependency conflicts.
Andrew
MD Danish Anwar
reviewerRe: [PATCH net-next v8 2/2] net: ti: icssg_prueth: add TAPRIO offload support
Quoted 7 lines · Andrew Lunn
Quoted 6 lines
When I had posted this series (v8) the ICSSG switch series was not merged yet and I had rebased this series on net-next/main. When you tested it, the ICSSG Series was merged and as it resulted in conflict.
I will rebase it on the latest net-next and make sure that their is no conflict and post next revision.
Quoted 8 lines
This is what i asked about, what are the build dependencies. Please always state them in the cover note.
In general, we recommend what when you have two or more patch series for a driver floating around, mark all but one RFC, so you get comments on them, but it is clear there is no need to try to apply them because of dependency conflicts.
I undertsand that Andrew. I will take care of that from now.
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
RE: [PATCH net-next v8 2/2] net: ti: icssg_prueth: add TAPRIO offload support
In reply to Anwar, Md DanishQuoted 64 lines
-----Original Message-----
From: Anwar, Md Danish <[email protected]>
Sent: Thursday, May 30, 2024 9:25 PM
To: Keller, Jacob E <[email protected]>; MD Danish Anwar <[email protected]>; Kiszka, Jan <[email protected]>; Dan Carpenter <[email protected]>; Andrew Lunn <[email protected]>; Simon Horman <[email protected]>; Diogo Ivo <[email protected]>; Wolfram Sang <[email protected]>; Randy Dunlap <[email protected]>; Niklas Schnelle <[email protected]>; Vladimir Oltean <[email protected]>; Vignesh Raghavendra <[email protected]>; Richard Cochran <[email protected]>; Roger Quadros <[email protected]>; Paolo Abeni <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; David S. Miller <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; Roger Quadros <[email protected]>
Subject: Re: [PATCH net-next v8 2/2] net: ti:icssg_prueth: add TAPRIO offload supportHi Jacob,
Quoted 23 lines · Jacob Keller
Quoted 14 lines · MD Danish Anwar
From: Roger Quadros <[email protected]>
The ICSSG dual-emac / switch firmware 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 callingndo_setup_tc()ndo ops. This patch implementsndo_setup_tc()to offload EST configuration to ICSSG.Quoted 5 lines
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Vignesh Raghavendra <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by MD Danish Anwar <[email protected]>---
Quoted 6 lines
I tried to apply this series to review it. Unfortunately It no longer applies cleanly since it has textual conflicts with
972383aecf43("net:
ti: icssg-switch: Add switchdev based driver for ethernet switch support"), which was part of:Quoted 5 lines
The conflict seemed easy enough to resolve, but I'm not sure if the
prueth_qosstructure would be placed optimally. I tried to build the driver to check what the placement should be and was unable to get things to compile.When I had posted this series (v8) the ICSSG switch series was not merged yet and I had rebased this series on net-next/main. When you tested it, the ICSSG Series was merged and as it resulted in conflict.
Quoted 8 lines
I will rebase it on the latest net-next and make sure that their is no conflict and post next revision.
Thanks for your feedback.
--
Thanks and Regards,
Md Danish Anwar
I assumed as much 😊 I just wanted to point out that the conflict is non-trivial because its hard to tell whether the new structure would fit best before or after the other data added by the switch series, or if it would be even better to arrange it somewhere else in the structure entirely.
Thanks,
Jake