netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <w-kwok2@ti.com>, <linux-kernel@vger.kernel.org>,
	<davem@davemloft.net>, <netdev@vger.kernel.org>, <nsekhar@ti.com>,
	<grygorii.strashko@ti.com>
Subject: Re: [net-next 2/2] net: netcp: ethss: k2g: add promiscuous mode support
Date: Mon, 2 Apr 2018 14:40:30 -0400	[thread overview]
Message-ID: <4e45994e-7609-e8ed-a05b-d5b577aaa0bb@ti.com> (raw)
In-Reply-To: <20180402164708.GD14165@lunn.ch>

Andrew,

Thanks for reviewing this!

On 04/02/2018 12:47 PM, Andrew Lunn wrote:
> On Mon, Apr 02, 2018 at 12:17:19PM -0400, Murali Karicheri wrote:
>> +static int gbe_set_rx_mode(void *intf_priv, bool promisc)
>> +{
>> +	struct gbe_intf *gbe_intf = intf_priv;
>> +	struct gbe_priv *gbe_dev = gbe_intf->gbe_dev;
>> +	struct cpsw_ale *ale = gbe_dev->ale;
>> +	unsigned long timeout;
>> +	int i, ret = -ETIMEDOUT;
>> +
>> +	/* Disable(1)/Enable(0) Learn for all ports (host is port 0 and
>> +	 * slaves are port 1 and up
>> +	 */
>> +	for (i = 0; i <= gbe_dev->num_slaves; i++) {
>> +		cpsw_ale_control_set(ale, i,
>> +				     ALE_PORT_NOLEARN, !!promisc);
>> +		cpsw_ale_control_set(ale, i,
>> +				     ALE_PORT_NO_SA_UPDATE, !!promisc);
>> +	}
> 
> Hi Murali
> 
> Does this mean that in promisc mode, switching of frames between ports
> in hardware is disabled? You are relying on the software bridge to
> perform such bridging between ports?

The K2G switch has only one slave port. The other port is the host port.
So there is no switching applicable here. At the egress drivers provide 
frame with PS_FLAG to indicate which port the frame is forwarded to and
at the Ingress direction, it forward the received frame to the Host port
which is the only other port in a K2G switch (2u). To Implement
promiscuous mode, this requires ALE to be enabled and take advantage of
ALE feature to flood all received unicast frames to host port. In the 
non-promiscuous mode, it disables that feature. So only frames with
destination MAC address match is forwarded.

For other K2 devices that has more than one port available, what you say
is applicable. However we have not implemented the switch mode of these
devices with multiple ports and don't have plan to do the same anytime
in the future as this device is already matured and adding this feature
at this point doesn't make much sense now. The driver on these devices
currently bypass ALE and implement plain Ethernet interfaces (n port)
for Ethernet connectivity.

> 
> You might want to look at skb->offload_fwd_mark. By setting this, you
> can tell the software bridge the hardware has already bridged the
> frame. You might then be able to have promisc enabled, and the
> hardware still doing the forwarding.

Yes, if we decide to support switch mode for K2 devices, I will certainly
look at this and add support as you have suggested.

> 
> 	 Andrew
> 


-- 
Murali Karicheri
Linux Kernel, Keystone

  reply	other threads:[~2018-04-02 18:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 16:17 [net-next 0/2] Add promiscous mode support in k2g network driver Murali Karicheri
2018-04-02 16:17 ` [net-next 1/2] net: netcp: add api to support set rx mode in netcp modules Murali Karicheri
2018-04-02 16:17 ` [net-next 2/2] net: netcp: ethss: k2g: add promiscuous mode support Murali Karicheri
2018-04-02 16:47   ` Andrew Lunn
2018-04-02 18:40     ` Murali Karicheri [this message]
2018-04-02 16:28 ` [net-next 0/2] Add promiscous mode support in k2g network driver David Miller
2018-04-02 18:42   ` Murali Karicheri

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=4e45994e-7609-e8ed-a05b-d5b577aaa0bb@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=w-kwok2@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;
as well as URLs for NNTP newsgroup(s).