netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 11/85] Documentation: networking: switchdev: fix command for static FDB entries
Date: Wed,  5 May 2021 12:35:34 -0400	[thread overview]
Message-ID: <20210505163648.3462507-11-sashal@kernel.org> (raw)
In-Reply-To: <20210505163648.3462507-1-sashal@kernel.org>

From: Vladimir Oltean <vladimir.oltean@nxp.com>

[ Upstream commit 787a4109f46847975ffae7d528a55c6b768ef0aa ]

The "bridge fdb add" command provided in the switchdev documentation is
junk now, not only because it is syntactically incorrect and rejected by
the iproute2 bridge program, but also because it was not updated in
light of Arkadi Sharshevsky's radical switchdev refactoring in commit
29ab586c3d83 ("net: switchdev: Remove bridge bypass support from
switchdev"). Try to explain what the intended usage pattern is with the
new kernel implementation.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 Documentation/networking/switchdev.rst | 47 +++++++++++++++++++-------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/Documentation/networking/switchdev.rst b/Documentation/networking/switchdev.rst
index ddc3f35775dc..650553cdec79 100644
--- a/Documentation/networking/switchdev.rst
+++ b/Documentation/networking/switchdev.rst
@@ -181,18 +181,41 @@ To offloading L2 bridging, the switchdev driver/device should support:
 Static FDB Entries
 ^^^^^^^^^^^^^^^^^^
 
-The switchdev driver should implement ndo_fdb_add, ndo_fdb_del and ndo_fdb_dump
-to support static FDB entries installed to the device.  Static bridge FDB
-entries are installed, for example, using iproute2 bridge cmd::
-
-	bridge fdb add ADDR dev DEV [vlan VID] [self]
-
-The driver should use the helper switchdev_port_fdb_xxx ops for ndo_fdb_xxx
-ops, and handle add/delete/dump of SWITCHDEV_OBJ_ID_PORT_FDB object using
-switchdev_port_obj_xxx ops.
-
-XXX: what should be done if offloading this rule to hardware fails (for
-example, due to full capacity in hardware tables) ?
+A driver which implements the ``ndo_fdb_add``, ``ndo_fdb_del`` and
+``ndo_fdb_dump`` operations is able to support the command below, which adds a
+static bridge FDB entry::
+
+        bridge fdb add dev DEV ADDRESS [vlan VID] [self] static
+
+(the "static" keyword is non-optional: if not specified, the entry defaults to
+being "local", which means that it should not be forwarded)
+
+The "self" keyword (optional because it is implicit) has the role of
+instructing the kernel to fulfill the operation through the ``ndo_fdb_add``
+implementation of the ``DEV`` device itself. If ``DEV`` is a bridge port, this
+will bypass the bridge and therefore leave the software database out of sync
+with the hardware one.
+
+To avoid this, the "master" keyword can be used::
+
+        bridge fdb add dev DEV ADDRESS [vlan VID] master static
+
+The above command instructs the kernel to search for a master interface of
+``DEV`` and fulfill the operation through the ``ndo_fdb_add`` method of that.
+This time, the bridge generates a ``SWITCHDEV_FDB_ADD_TO_DEVICE`` notification
+which the port driver can handle and use it to program its hardware table. This
+way, the software and the hardware database will both contain this static FDB
+entry.
+
+Note: for new switchdev drivers that offload the Linux bridge, implementing the
+``ndo_fdb_add`` and ``ndo_fdb_del`` bridge bypass methods is strongly
+discouraged: all static FDB entries should be added on a bridge port using the
+"master" flag. The ``ndo_fdb_dump`` is an exception and can be implemented to
+visualize the hardware tables, if the device does not have an interrupt for
+notifying the operating system of newly learned/forgotten dynamic FDB
+addresses. In that case, the hardware FDB might end up having entries that the
+software FDB does not, and implementing ``ndo_fdb_dump`` is the only way to see
+them.
 
 Note: by default, the bridge does not filter on VLAN and only bridges untagged
 traffic.  To enable VLAN support, turn on VLAN filtering::
-- 
2.30.2


  parent reply	other threads:[~2021-05-05 16:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 16:35 [PATCH AUTOSEL 5.10 01/85] ath11k: fix thermal temperature read Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 06/85] tipc: convert dest node's address to network order Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 08/85] net/mlx5e: Use net_prefetchw instead of prefetchw in MPWQE TX datapath Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 09/85] net: stmmac: Set FIFO sizes for ipq806x Sasha Levin
2021-05-05 16:35 ` Sasha Levin [this message]
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 12/85] Bluetooth: Fix incorrect status handling in LE PHY UPDATE event Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 18/85] Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 19/85] Bluetooth: verify AMP hci_chan before amp_destroy Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 20/85] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 21/85] net/sched: cls_flower: use ntohs for struct flow_dissector_key_ports Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 22/85] net: bridge: when suppression is enabled exclude RARP packets Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 23/85] Bluetooth: check for zapped sk before connecting Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 26/85] net: hns3: remediate a potential overflow risk of bd_num_list Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 27/85] net: hns3: add handling for xmit skb with recursive fraglist Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 28/85] ip6_vti: proper dev_{hold|put} in ndo_[un]init methods Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 30/85] ice: handle increasing Tx or Rx ring sizes Sasha Levin
2021-05-05 16:35 ` [PATCH AUTOSEL 5.10 31/85] net: usb: ax88179_178a: initialize local variables before use Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 38/85] mac80211: clear the beacon's CRC after channel switch Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 40/85] rtw88: 8822c: add LC calibration for RTL8822C Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 41/85] mt76: mt7615: support loading EEPROM for MT7613BE Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 42/85] mt76: mt76x0: disable GTK offloading Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 43/85] mt76: mt7915: fix txpower init for TSSI off chips Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 47/85] iwlwifi: pcie: make cfg vs. trans_cfg more robust Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 53/85] selftests: Set CC to clang in lib.mk if LLVM is set Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 58/85] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 59/85] flow_dissector: Fix out-of-bounds warning in __skb_flow_bpf_to_target() Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 62/85] ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user() Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 63/85] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 64/85] samples/bpf: Fix broken tracex1 due to kprobe argument change Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 69/85] mt76: mt7615: fix entering driver-own state on mt7663 Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 71/85] wl3501_cs: Fix out-of-bounds warnings in wl3501_send_pkt Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 72/85] wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 73/85] qtnfmac: Fix possible buffer overflow in qtnf_event_handle_external_auth Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 75/85] iavf: remove duplicate free resources calls Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 76/85] net: ethernet: mtk_eth_soc: fix RX VLAN offload Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 77/85] selftests: mlxsw: Increase the tolerance of backlog buildup Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 78/85] selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test Sasha Levin
2021-05-05 16:36 ` [PATCH AUTOSEL 5.10 80/85] bnxt_en: Add PCI IDs for Hyper-V VF devices Sasha Levin

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=20210505163648.3462507-11-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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).