From: Parvathi Pudi <parvathi@couthit.com>
To: Md Danish Anwar <a0501179@ti.com>
Cc: parvathi <parvathi@couthit.com>,
andrew+netdev <andrew+netdev@lunn.ch>,
davem <davem@davemloft.net>, edumazet <edumazet@google.com>,
kuba <kuba@kernel.org>, pabeni <pabeni@redhat.com>,
danishanwar <danishanwar@ti.com>, rogerq <rogerq@kernel.org>,
pmohan <pmohan@couthit.com>, basharath <basharath@couthit.com>,
afd <afd@ti.com>, linux-kernel <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
pratheesh <pratheesh@ti.com>, Prajith Jayarajan <prajith@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
praneeth <praneeth@ti.com>, srk <srk@ti.com>,
rogerq <rogerq@ti.com>, krishna <krishna@couthit.com>,
mohan <mohan@couthit.com>
Subject: Re: [RFC PATCH net-next v2 3/3] net: ti: icssm-prueth: Adds support for ICSSM RSTP switch
Date: Tue, 7 Oct 2025 19:01:48 +0530 (IST) [thread overview]
Message-ID: <1064562813.13523.1759843908228.JavaMail.zimbra@couthit.local> (raw)
In-Reply-To: <44ed3d16-a8d2-49f3-a6b4-16d9a14d1cc6@ti.com>
Hi,
> Hi Parvathi,
>
> On 10/6/2025 4:17 PM, Parvathi Pudi wrote:
>> From: Roger Quadros <rogerq@ti.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@couthit.com>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>
>> Signed-off-by: Parvathi Pudi <parvathi@couthit.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.
prev parent reply other threads:[~2025-10-07 13:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 10:47 [RFC PATCH net-next v2 0/3] STP/RSTP SWITCH support for PRU-ICSSM Ethernet driver Parvathi Pudi
2025-10-06 10:47 ` [RFC PATCH net-next v2 1/3] net: ti: icssm-prueth: Adds helper functions to configure and maintain FDB Parvathi Pudi
2025-10-06 10:47 ` [RFC PATCH net-next v2 2/3] net: ti: icssm-prueth: Adds switchdev support for icssm_prueth driver Parvathi Pudi
2025-10-06 10:47 ` [RFC PATCH net-next v2 3/3] net: ti: icssm-prueth: Adds support for ICSSM RSTP switch Parvathi Pudi
2025-10-06 14:38 ` Anwar, Md Danish
2025-10-07 13:31 ` Parvathi Pudi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1064562813.13523.1759843908228.JavaMail.zimbra@couthit.local \
--to=parvathi@couthit.com \
--cc=a0501179@ti.com \
--cc=afd@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=basharath@couthit.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=krishna@couthit.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohan@couthit.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pmohan@couthit.com \
--cc=prajith@ti.com \
--cc=praneeth@ti.com \
--cc=pratheesh@ti.com \
--cc=rogerq@kernel.org \
--cc=rogerq@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox