Configurable VLAN mode for NCSI driver
Subsystems (4)
cover Configurable VLAN mode for NCSI driver
Currently kernel kernel NCSI driver only supports the "VLAN + non-VLAN" mode (Mode #2), but this mode is an optional mode [1] defined in NCSI specification and some NCSI devices like Intel E810 Network Adapter [2] does not support that mode. This patchset adds a new "ncsi,vlan-mode" device tree property for configuring the VLAN mode of NCSI device.
[1] Table 58 - VLAN Enable Modes
https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.0.pdf [2] 12.6.5.4.3 VLAN https://cdrdv2.intel.com/v1/dl/getContent/613875
Jiaqing Zhao (6):
net/ncsi: Fix value of NCSI_CAP_VLAN_ANY net/ncsi: Rename NCSI_CAP_VLAN_NO to NCSI_CAP_VLAN_FILTERED net/ncsi: Enable VLAN filtering when callback is registered
ftgmac100: Remove enable NCSI VLAN filtering
dt-bindings: net: Add NCSI bindings
net/ncsi: Support VLAN mode configuration
.../devicetree/bindings/net/ncsi.yaml | 34 ++++++++++++++ MAINTAINERS | 2 + drivers/net/ethernet/faraday/ftgmac100.c | 3 -- include/dt-bindings/net/ncsi.h | 15 ++++++ net/ncsi/internal.h | 5 +- net/ncsi/ncsi-manage.c | 46 ++++++++++++++++--- 6 files changed, 93 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/ncsi.yaml create mode 100644 include/dt-bindings/net/ncsi.h
Signature · 1 line
2.34.1
PATCH 1/6 net/ncsi: Fix value of NCSI_CAP_VLAN_ANY
According to the NCSI specification (DSP0222) [1], the value of allow Any VLAN + non-VLAN mode in Enable VLAN command should be 0x03.
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.0.pdf
--- net/ncsi/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ncsi/internal.h +1 -1
@@ -47,7 +47,7 @@ enum {NCSI_CAP_AEN_MASK =0x07 ,NCSI_CAP_VLAN_ONLY =0x01 ,/* Filter VLAN packet only */ NCSI_CAP_VLAN_NO =0x02 ,/* Filter VLAN and non-VLAN */ -NCSI_CAP_VLAN_ANY =0x04 ,/* Filter Any-and-non-VLAN */ +NCSI_CAP_VLAN_ANY =0x03 ,/* Filter Any-and-non-VLAN */ NCSI_CAP_VLAN_MASK = 0x07 };
Signature · 1 line
2.34.1
PATCH 2/6 net/ncsi: Rename NCSI_CAP_VLAN_NO to NCSI_CAP_VLAN_FILTERED
In reply to Jiaqing ZhaoThe NCSI_CAP_VLAN_NO actually stands for the "VLAN + non-VLAN" mode defined in NCSI spec, which accepts both VLAN-tagged packets that match the enabled VLAN filter settings and non-VLAN-tagged packets. It would be more clear to rename it to NCSI_CAP_VLAN_FILTERED.
--- net/ncsi/internal.h | 2 +- net/ncsi/ncsi-manage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ncsi/internal.h +1 -1
@@ -46,7 +46,7 @@ enum {NCSI_CAP_AEN_HDS =0x04 ,/* HNC driver status */ NCSI_CAP_AEN_MASK =0x07 ,NCSI_CAP_VLAN_ONLY =0x01 ,/* Filter VLAN packet only */ -NCSI_CAP_VLAN_NO =0x02 ,/* Filter VLAN and non-VLAN */ +NCSI_CAP_VLAN_FILTERED =0x02 ,/* Filter VLAN and non-VLAN */ NCSI_CAP_VLAN_ANY =0x03 ,/* Filter Any-and-non-VLAN */ NCSI_CAP_VLAN_MASK = 0x07 };
net/ncsi/ncsi-manage.c +1 -1
@@ -1098,7 +1098,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) nca.type =NCSI_PKT_CMD_DV ; }else { nca.type =NCSI_PKT_CMD_EV ; - nca.bytes[3 ] =NCSI_CAP_VLAN_NO ; + nca.bytes[3 ] =NCSI_CAP_VLAN_FILTERED ; } nd->state = ncsi_dev_state_config_sma; }else if (nd->state == ncsi_dev_state_config_sma) {
Signature · 1 line
2.34.1
PATCH 3/6 net/ncsi: Enable VLAN filtering when callback is registered
In reply to Jiaqing ZhaoSets NETIF_F_HW_VLAN_CTAG_FILTER flag to enable hardware VLAN filtering of NCSI when the ndo_vlan_rx_{add,kill}_vid callbacks are registered to the NCSI handlers. Previously it was done in the mac driver, this patch puts it to the NCSI drvier to make it more general.
--- net/ncsi/ncsi-manage.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ncsi/ncsi-manage.c +5 -0
@@ -1807,6 +1807,11 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev, ndp->mlx_multi_host = true; } +/* Enable hardware VLAN filtering */ +if (dev->netdev_ops->ndo_vlan_rx_add_vid == ncsi_vlan_rx_add_vid && + dev->netdev_ops->ndo_vlan_rx_kill_vid == ncsi_vlan_rx_kill_vid) + dev->hw_features |=NETIF_F_HW_VLAN_CTAG_FILTER ; +return nd; }EXPORT_SYMBOL_GPL (ncsi_register_dev);
Signature · 1 line
2.34.1
PATCH 4/6 ftgmac100: Remove enable NCSI VLAN filtering
In reply to Jiaqing ZhaoSetting NETIF_F_HW_VLAN_CTAG_FILTER flag to enable NCSI VLAN filtering has been moved to the NCSI driver, the logic in ftgmac100 driver is no longer needed.
--- drivers/net/ethernet/faraday/ftgmac100.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +0 -3
@@ -1922,9 +1922,6 @@ static int ftgmac100_probe(struct platform_device *pdev)NETIF_F_GRO |NETIF_F_SG |NETIF_F_HW_VLAN_CTAG_RX |NETIF_F_HW_VLAN_CTAG_TX ; -if (priv->use_ncsi) - netdev->hw_features |=NETIF_F_HW_VLAN_CTAG_FILTER ; -/* AST2400 doesn't have working HW checksum generation */ if (np && (of_device_is_compatible (np,"aspeed,ast2400-mac" ))) netdev->hw_features &= ~NETIF_F_HW_CSUM ;
Signature · 1 line
2.34.1
PATCH 5/6 dt-bindings: net: Add NCSI bindings
In reply to Jiaqing ZhaoAdd devicetree bindings for NCSI VLAN modes. This allows VLAN mode to be configured in devicetree.
--- .../devicetree/bindings/net/ncsi.yaml | 34 +++++++++++++++++++ MAINTAINERS | 2 ++ include/dt-bindings/net/ncsi.h | 15 ++++++++ 3 files changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/ncsi.yaml create mode 100644 include/dt-bindings/net/ncsi.h
Documentation/devicetree/bindings/net/ncsi.yaml new file +34 -0
@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/ncsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Network Controller Sideband Interface (NCSI) + +maintainers: + - Samuel Mendoza-Jonas <[email protected]> + +description: | + Bindings for the Network Controller Sideband Interface (NCSI) driver + +properties: + ncsi,vlan-mode: + description: VLAN mode used on the NCSI device. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + +examples: + - | + #include <dt-bindings/net/ncsi.h> + + mac0: ethernet@1e660000 { + compatible = "aspeed,ast2600-mac", "faraday,ftgmac100"; + reg = <0x1e660000 0x180>; + status = "okay"; + + use-ncsi; + ncsi,vlan-mode = <NCSI_VLAN_MODE_ANY>; + }; + +...
MAINTAINERS +2 -0
@@ -13534,6 +13534,8 @@ F: drivers/scsi/sun3_scsi_vme.c NCSI LIBRARY M: Samuel Mendoza-Jonas <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/net/ncsi.yaml +F: include/dt-bindings/net/ncsi.h F: net/ncsi/ NCT6775 HARDWARE MONITOR DRIVER
include/dt-bindings/net/ncsi.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Device Tree constants for NCSI +*/ + +#ifndef _DT_BINDINGS_NCSI_H +#define _DT_BINDINGS_NCSI_H + +/* VLAN Modes */ +#define NCSI_VLAN_MODE_DISABLED 0 +#define NCSI_VLAN_MODE_ONLY 1 +#define NCSI_VLAN_MODE_FILTERED 2 +#define NCSI_VLAN_MODE_ANY 3 + +#endif
Signature · 1 line
2.34.1
PATCH 6/6 net/ncsi: Support VLAN mode configuration
In reply to Jiaqing ZhaoNCSI specification defines 4 VLAN modes, currently kernel NCSI driver only supports the "VLAN + non-VLAN" mode (Mode #2), and there is no way to detect which modes are supported by the device. This patch adds support for configuring VLAN mode via the "ncsi,vlan-mode" devicetree node.
--- net/ncsi/internal.h | 1 + net/ncsi/ncsi-manage.c | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-)
net/ncsi/internal.h +1 -0
@@ -334,6 +334,7 @@ struct ncsi_dev_priv {struct work_struct work;/* For channel management */ struct packet_type ptype;/* NCSI packet Rx handler */ struct list_head node;/* Form NCSI device list */ +u32 vlan_mode;/* VLAN mode */ #define NCSI_MAX_VLAN_VIDS 15struct list_head vlan_vids;/* List of active VLAN IDs */
net/ncsi/ncsi-manage.c +34 -7
73 lines not on this page · raw message
Signature · 1 line
2.34.1