lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1064562813.13523.1759843908228.JavaMail.zimbra@couthit.local>
Date: Tue, 7 Oct 2025 19:01:48 +0530 (IST)
From: Parvathi Pudi <parvathi@...thit.com>
To: Md Danish Anwar <a0501179@...com>
Cc: parvathi <parvathi@...thit.com>, andrew+netdev <andrew+netdev@...n.ch>, 
	davem <davem@...emloft.net>, edumazet <edumazet@...gle.com>, 
	kuba <kuba@...nel.org>, pabeni <pabeni@...hat.com>, 
	danishanwar <danishanwar@...com>, rogerq <rogerq@...nel.org>, 
	pmohan <pmohan@...thit.com>, basharath <basharath@...thit.com>, 
	afd <afd@...com>, linux-kernel <linux-kernel@...r.kernel.org>, 
	netdev <netdev@...r.kernel.org>, 
	linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>, 
	pratheesh <pratheesh@...com>, Prajith Jayarajan <prajith@...com>, 
	Vignesh Raghavendra <vigneshr@...com>, praneeth <praneeth@...com>, 
	srk <srk@...com>, rogerq <rogerq@...com>, 
	krishna <krishna@...thit.com>, mohan <mohan@...thit.com>
Subject: Re: [RFC PATCH net-next v2 3/3] net: ti: icssm-prueth: Adds support
 for ICSSM RSTP switch

Hi,

> Hi Parvathi,
> 
> On 10/6/2025 4:17 PM, Parvathi Pudi wrote:
>> From: Roger Quadros <rogerq@...com>
>> 
>> Adds support for RSTP switch mode by enhancing the existing ICSSM dual EMAC
>> driver with switchdev support.
>> 
>> With this patch, the PRU-ICSSM is now capable of operating in switch mode
>> with the 2 PRU ports acting as external ports and the host acting as an
>> internal port. Packets received from the PRU ports will be forwarded to
>> the host (store and forward mode) and also to the other PRU port (either
>> using store and forward mode or via cut-through mode). Packets coming
>> from the host will be transmitted either from one or both of the PRU ports
>> (depending on the FDB decision).
>> 
>> By default, the dual EMAC firmware will be loaded in the PRU-ICSS
>> subsystem. To configure the PRU-ICSS to operate as a switch, a different
>> firmware must to be loaded.
>> 
>> Reviewed-by: Mohan Reddy Putluru <pmohan@...thit.com>
>> Signed-off-by: Roger Quadros <rogerq@...com>
>> Signed-off-by: Andrew F. Davis <afd@...com>
>> Signed-off-by: Basharath Hussain Khaja <basharath@...thit.com>
>> Signed-off-by: Parvathi Pudi <parvathi@...thit.com>
>> ---
> 
> [ ... ]>
>> +static void icssm_prueth_change_to_switch_mode(struct prueth *prueth)
>> +{
>> +	bool portstatus[PRUETH_NUM_MACS];
>> +	struct prueth_emac *emac;
>> +	struct net_device *ndev;
>> +	int i, ret;
>> +
>> +	for (i = 0; i < PRUETH_NUM_MACS; i++) {
>> +		emac = prueth->emac[i];
>> +		ndev = emac->ndev;
>> +
>> +		portstatus[i] = netif_running(ndev);
>> +		if (!portstatus[i])
>> +			continue;
>> +
>> +		ret = ndev->netdev_ops->ndo_stop(ndev);
>> +		if (ret < 0) {
>> +			netdev_err(ndev, "failed to stop: %d", ret);
>> +			return;
>> +		}
>> +	}
>> +
>> +	prueth->eth_type = PRUSS_ETHTYPE_SWITCH;
>> +
>> +	for (i = 0; i < PRUETH_NUM_MACS; i++) {
>> +		emac = prueth->emac[i];
>> +		ndev = emac->ndev;
>> +
>> +		if (!portstatus[i])
>> +			continue;
>> +
>> +		ret = ndev->netdev_ops->ndo_open(ndev);
>> +		if (ret < 0) {
>> +			netdev_err(ndev, "failed to start: %d", ret);
>> +			return;
>> +		}
>> +	}
>> +
>> +	dev_info(prueth->dev, "TI PRU ethernet now in Switch mode\n");
>> +}
>> +
>> +static void icssm_prueth_change_to_emac_mode(struct prueth *prueth)
>> +{
>> +	bool portstatus[PRUETH_NUM_MACS];
>> +	struct prueth_emac *emac;
>> +	struct net_device *ndev;
>> +	int i, ret;
>> +
>> +	for (i = 0; i < PRUETH_NUM_MACS; i++) {
>> +		emac = prueth->emac[i];
>> +		ndev = emac->ndev;
>> +
>> +		portstatus[i] = netif_running(ndev);
>> +		if (!portstatus[i])
>> +			continue;
>> +
>> +		ret = ndev->netdev_ops->ndo_stop(ndev);
>> +		if (ret < 0) {
>> +			netdev_err(ndev, "failed to stop: %d", ret);
>> +			return;
>> +		}
>> +	}
>> +
>> +	prueth->eth_type = PRUSS_ETHTYPE_EMAC;
>> +
>> +	for (i = 0; i < PRUETH_NUM_MACS; i++) {
>> +		emac = prueth->emac[i];
>> +		ndev = emac->ndev;
>> +
>> +		if (!portstatus[i])
>> +			continue;
>> +
>> +		ret = ndev->netdev_ops->ndo_open(ndev);
>> +		if (ret < 0) {
>> +			netdev_err(ndev, "failed to start: %d", ret);
>> +			return;
>> +		}
>> +	}
>> +
>> +	dev_info(prueth->dev, "TI PRU ethernet now in Dual EMAC mode\n");
>> +}
> 
> 
> The APIs icssm_prueth_change_to_emac_mode and
> icssm_prueth_change_to_switch_mode seems identical. Won't it be better
> to have one function to change modes and which mode to go to passed as
> function argument.
> 
>	icssm_prueth_change_mode(prueth,mode);
> 
> This will also work seemlessly if you add more modes in future. With
> current approach you will need to add new APIs
> icssm_prueth_change_to_xyz_mode()
> 
> 

Sure, we will check and modify the code to use a single API,
icssm_prueth_change_mode() which will take the mode as an argument.

We will address this in the next version.


Thanks and Regards,
Parvathi.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ