netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ti: icssg-prueth: Add prp offload support to ICSSG driver
@ 2025-06-10  6:16 Himanshu Mittal
  2025-06-12  0:04 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Himanshu Mittal @ 2025-06-10  6:16 UTC (permalink / raw)
  To: h-mittal1, pabeni, kuba, edumazet, davem, andrew+netdev
  Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
	Roger Quadros, danishanwar, m-malladi, pratheesh, prajith

Add support for ICSSG PRP mode which supports offloading of:
 - Packet duplication and PRP trailer insertion
 - Packet duplicate discard and PRP trailer removal

Signed-off-by: Himanshu Mittal <h-mittal1@ti.com>
---
 drivers/net/ethernet/ti/icssg/icssg_prueth.c | 23 +++++++++++++++++++-
 drivers/net/ethernet/ti/icssg/icssg_prueth.h |  3 +++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 86fc1278127c..65883c7851c5 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -138,6 +138,19 @@ static struct icssg_firmwares icssg_hsr_firmwares[] = {
 	}
 };
 
+static struct icssg_firmwares icssg_prp_firmwares[] = {
+	{
+		.pru = "ti-pruss/am65x-sr2-pru0-pruprp-fw.elf",
+		.rtu = "ti-pruss/am65x-sr2-rtu0-pruprp-fw.elf",
+		.txpru = "ti-pruss/am65x-sr2-txpru0-pruprp-fw.elf",
+	},
+	{
+		.pru = "ti-pruss/am65x-sr2-pru1-pruprp-fw.elf",
+		.rtu = "ti-pruss/am65x-sr2-rtu1-pruprp-fw.elf",
+		.txpru = "ti-pruss/am65x-sr2-txpru1-pruprp-fw.elf",
+	}
+};
+
 static struct icssg_firmwares icssg_switch_firmwares[] = {
 	{
 		.pru = "ti-pruss/am65x-sr2-pru0-prusw-fw.elf",
@@ -187,8 +200,10 @@ static int prueth_emac_start(struct prueth *prueth)
 
 	if (prueth->is_switch_mode)
 		firmwares = icssg_switch_firmwares;
-	else if (prueth->is_hsr_offload_mode)
+	else if (prueth->is_hsr_offload_mode && HSR_V1 == prueth->hsr_prp_version)
 		firmwares = icssg_hsr_firmwares;
+	else if (prueth->is_hsr_offload_mode && PRP_V1 == prueth->hsr_prp_version)
+		firmwares = icssg_prp_firmwares;
 	else
 		firmwares = icssg_emac_firmwares;
 
@@ -1566,6 +1581,7 @@ static int prueth_netdevice_event(struct notifier_block *unused,
 	struct netdev_notifier_changeupper_info *info;
 	struct prueth_emac *emac = netdev_priv(ndev);
 	struct prueth *prueth = emac->prueth;
+	enum hsr_version hsr_ndev_version;
 	int ret = NOTIFY_DONE;
 
 	if (ndev->netdev_ops != &emac_netdev_ops)
@@ -1577,6 +1593,11 @@ static int prueth_netdevice_event(struct notifier_block *unused,
 
 		if ((ndev->features & NETIF_PRUETH_HSR_OFFLOAD_FEATURES) &&
 		    is_hsr_master(info->upper_dev)) {
+			hsr_get_version(info->upper_dev, &hsr_ndev_version);
+			if (hsr_ndev_version != HSR_V1 && hsr_ndev_version != PRP_V1)
+				return -EOPNOTSUPP;
+			prueth->hsr_prp_version = hsr_ndev_version;
+
 			if (info->linking) {
 				if (!prueth->hsr_dev) {
 					prueth->hsr_dev = info->upper_dev;
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h
index 23c465f1ce7f..02d9d76cd287 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h
@@ -13,6 +13,7 @@
 #include <linux/etherdevice.h>
 #include <linux/genalloc.h>
 #include <linux/if_vlan.h>
+#include <linux/if_hsr.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mfd/syscon.h>
@@ -290,6 +291,7 @@ struct icssg_firmwares {
  * @vlan_tbl: VLAN-FID table pointer
  * @hw_bridge_dev: pointer to HW bridge net device
  * @hsr_dev: pointer to the HSR net device
+ * @hsr_prp_version: enum to store the protocol version of hsr master
  * @br_members: bitmask of bridge member ports
  * @hsr_members: bitmask of hsr member ports
  * @prueth_netdevice_nb: netdevice notifier block
@@ -329,6 +331,7 @@ struct prueth {
 
 	struct net_device *hw_bridge_dev;
 	struct net_device *hsr_dev;
+	enum hsr_version hsr_prp_version;
 	u8 br_members;
 	u8 hsr_members;
 	struct notifier_block prueth_netdevice_nb;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ti: icssg-prueth: Add prp offload support to ICSSG driver
  2025-06-10  6:16 [PATCH net-next] net: ti: icssg-prueth: Add prp offload support to ICSSG driver Himanshu Mittal
@ 2025-06-12  0:04 ` Jakub Kicinski
  2025-06-12  5:20   ` MD Danish Anwar
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-06-12  0:04 UTC (permalink / raw)
  To: Himanshu Mittal
  Cc: pabeni, edumazet, davem, andrew+netdev, linux-kernel, netdev,
	linux-arm-kernel, srk, Vignesh Raghavendra, Roger Quadros,
	danishanwar, m-malladi, pratheesh, prajith

On Tue, 10 Jun 2025 11:46:38 +0530 Himanshu Mittal wrote:
> Add support for ICSSG PRP mode which supports offloading of:
>  - Packet duplication and PRP trailer insertion
>  - Packet duplicate discard and PRP trailer removal
> 
> Signed-off-by: Himanshu Mittal <h-mittal1@ti.com>
> ---
>  drivers/net/ethernet/ti/icssg/icssg_prueth.c | 23 +++++++++++++++++++-
>  drivers/net/ethernet/ti/icssg/icssg_prueth.h |  3 +++
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> index 86fc1278127c..65883c7851c5 100644
> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> @@ -138,6 +138,19 @@ static struct icssg_firmwares icssg_hsr_firmwares[] = {
>  	}
>  };
>  
> +static struct icssg_firmwares icssg_prp_firmwares[] = {
> +	{
> +		.pru = "ti-pruss/am65x-sr2-pru0-pruprp-fw.elf",
> +		.rtu = "ti-pruss/am65x-sr2-rtu0-pruprp-fw.elf",
> +		.txpru = "ti-pruss/am65x-sr2-txpru0-pruprp-fw.elf",
> +	},
> +	{
> +		.pru = "ti-pruss/am65x-sr2-pru1-pruprp-fw.elf",
> +		.rtu = "ti-pruss/am65x-sr2-rtu1-pruprp-fw.elf",
> +		.txpru = "ti-pruss/am65x-sr2-txpru1-pruprp-fw.elf",
> +	}
> +};

AFAIU your coworker is removing the static names, please wait until 
the dust is settled on that:

https://lore.kernel.org/all/20250610052501.3444441-1-danishanwar@ti.com/
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ti: icssg-prueth: Add prp offload support to ICSSG driver
  2025-06-12  0:04 ` Jakub Kicinski
@ 2025-06-12  5:20   ` MD Danish Anwar
  0 siblings, 0 replies; 3+ messages in thread
From: MD Danish Anwar @ 2025-06-12  5:20 UTC (permalink / raw)
  To: Jakub Kicinski, Himanshu Mittal
  Cc: pabeni, edumazet, davem, andrew+netdev, linux-kernel, netdev,
	linux-arm-kernel, srk, Vignesh Raghavendra, Roger Quadros,
	m-malladi, pratheesh, prajith



On 12/06/25 5:34 am, Jakub Kicinski wrote:
> On Tue, 10 Jun 2025 11:46:38 +0530 Himanshu Mittal wrote:
>> Add support for ICSSG PRP mode which supports offloading of:
>>  - Packet duplication and PRP trailer insertion
>>  - Packet duplicate discard and PRP trailer removal
>>
>> Signed-off-by: Himanshu Mittal <h-mittal1@ti.com>
>> ---
>>  drivers/net/ethernet/ti/icssg/icssg_prueth.c | 23 +++++++++++++++++++-
>>  drivers/net/ethernet/ti/icssg/icssg_prueth.h |  3 +++
>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> index 86fc1278127c..65883c7851c5 100644
>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> @@ -138,6 +138,19 @@ static struct icssg_firmwares icssg_hsr_firmwares[] = {
>>  	}
>>  };
>>  
>> +static struct icssg_firmwares icssg_prp_firmwares[] = {
>> +	{
>> +		.pru = "ti-pruss/am65x-sr2-pru0-pruprp-fw.elf",
>> +		.rtu = "ti-pruss/am65x-sr2-rtu0-pruprp-fw.elf",
>> +		.txpru = "ti-pruss/am65x-sr2-txpru0-pruprp-fw.elf",
>> +	},
>> +	{
>> +		.pru = "ti-pruss/am65x-sr2-pru1-pruprp-fw.elf",
>> +		.rtu = "ti-pruss/am65x-sr2-rtu1-pruprp-fw.elf",
>> +		.txpru = "ti-pruss/am65x-sr2-txpru1-pruprp-fw.elf",
>> +	}
>> +};
> 
> AFAIU your coworker is removing the static names, please wait until 
> the dust is settled on that:
> 
> https://lore.kernel.org/all/20250610052501.3444441-1-danishanwar@ti.com/

Yes, it's better to wait for that patch to get merged before we add new
firmware.

-- 
Thanks and Regards,
Danish

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-12  5:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10  6:16 [PATCH net-next] net: ti: icssg-prueth: Add prp offload support to ICSSG driver Himanshu Mittal
2025-06-12  0:04 ` Jakub Kicinski
2025-06-12  5:20   ` MD Danish Anwar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).