All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tristram.Ha@microchip.com
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org,
	UNGLinuxDriver@microchip.com
Subject: Re: dsa: dsa_slave_port_obj_del calls multiple times with SWITCHDEV_OBJ_ID_HOST_MDB obj id
Date: Wed, 6 Dec 2017 14:56:19 +0100	[thread overview]
Message-ID: <20171206135619.GE27063@lunn.ch> (raw)
In-Reply-To: <93AF473E2DA327428DE3D46B72B1E9FD4113DE40@CHN-SV-EXMX02.mchp-main.com>

On Wed, Dec 06, 2017 at 02:33:07AM +0000, Tristram.Ha@microchip.com wrote:
> I found the latest net-next kernel calls dsa_slave_port_obj_del() multiple times,
> one for each port, with host port as the parameter.

Hi Tristram

SWITCHDEV_OBJ_ID_HOST_MDB is used, when there is a join/leave on the
bridge interface. It happens for each interface in the bridge, and it
means, packets which match the group that ingress on that interface
should be forwarded to the CPU.

> As the base driver cannot find an entry with that host port, it returns an error
> and so users will see a lot of failures from the DSA switch.

You have a few options:

1) Just forward all multicast traffic to the cpu, and ignore
   SWITCHDEV_OBJ_ID_HOST_MDB.

2) Implement SWITCHDEV_OBJ_ID_HOST_MDB so you setup your tables to
   just forward the requested multicast to the cpu.

3) You can also forward a bit too much, e.g. if you cannot set filters
   per ingress port, just send all the traffic for the group from any
   port.


The bridge will discard whatever it does not need. 

> Is this a new behavior and the driver needs to handle that?  In previous versions
> I do not think I saw that.

SWITCHDEV_OBJ_ID_HOST_MDB is new. However, dsa_slave_port_obj_del()
can be called for all sorts of objects, and you should only be
reacting on those your support. So adding a new object should not of
changed anything.

> Typical operation is a PC connected to a port in a switch wants to send multicast
> packets.  It broadcasts an IGMP membership join message.  Function
> dsa_slave_port_obj_add is called to setup an entry in the lookup table.  When
> IGMP membership leave message is received dsa_slave_port_obj_del will be
> called after a delay.  But then it is called for each port with host port as the
> parameter.

Correct. switchdev is a generic API. It also needs to work for Top of
Rack switches, which generally have a match/action architecture. I can
imagine that this match/action happens per port, so we need to call
switchdev per port. However, switches supported by DSA tend to have
central management of all ports, so one call would be sufficient. With
a DSA driver, you just need to expect redundant calls, and do the
right thing.

      Andrew

  reply	other threads:[~2017-12-06 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06  2:33 dsa: dsa_slave_port_obj_del calls multiple times with SWITCHDEV_OBJ_ID_HOST_MDB obj id Tristram.Ha
2017-12-06 13:56 ` Andrew Lunn [this message]
2017-12-06 19:31   ` Tristram.Ha

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=20171206135619.GE27063@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.