You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "jlaitine (via GitHub)" <gi...@apache.org> on 2023/12/19 14:01:29 UTC
[PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
jlaitine opened a new pull request, #11422:
URL: https://github.com/apache/nuttx/pull/11422
## Summary
Add a static port-based VLAN configuration for KSZ9477 switch. This doesn't use the VLAN tagging, but is a switch's internal mechanism to simply configure if the packet forwarding is allowed from one port to another.
## Impact
This enables restricting traffic between switch ports, based on the device's network topology
## Testing
Tested on custom HW with mpfs + ksz9477 switch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #11422:
URL: https://github.com/apache/nuttx/pull/11422
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "jlaitine (via GitHub)" <gi...@apache.org>.
jlaitine commented on code in PR #11422:
URL: https://github.com/apache/nuttx/pull/11422#discussion_r1431818768
##########
include/nuttx/net/ksz9477.h:
##########
@@ -91,6 +91,62 @@ int ksz9477_i2c_init(struct i2c_master_s *i2c_bus,
# error Only I2c interface currently supported
#endif
+/****************************************************************************
+ * Name: ksz9477_enable_port_vlan
+ *
+ * Description:
+ * Enables static port-based VLAN, which can be configured in the switch
+ * queue management's port control registers
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_enable_port_vlan(void);
+
+/****************************************************************************
+ * Name: ksz9477_disable_port_vlan
+ *
+ * Description:
+ * Disables the static port-based VLAN
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_disable_port_vlan(void);
+
+/****************************************************************************
+ * Name: ksz9477_configure_port_vlan
+ *
+ * Description:
+ * Configures the static port-based VLAN for a single port
+ * The change will become effective next time when the switch is
+ * initialized.
+ *
+ * Input Parameters:
+ * port: The port being configured (1-7)
+ * disable: Bitmask of ports where frames may not be forwarded to.
+ * Bit 0 is for port 1, bit 1 for port 2 etc.
+ * enable: Bitmask of ports where frames may be forwarded to.
+ * Bit 0 is for port 1, bit 1 for port 2 etc.
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_configure_port_vlan(ksz9477_port_t port, uint8_t disable,
Review Comment:
On one of the boards I need to change the configuration run-time in specific conditions; I am doing that from board files by configuring the interface down, calling these functions and configuring it back up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "jlaitine (via GitHub)" <gi...@apache.org>.
jlaitine commented on code in PR #11422:
URL: https://github.com/apache/nuttx/pull/11422#discussion_r1438067907
##########
drivers/net/Kconfig:
##########
@@ -392,6 +392,18 @@ menuconfig NET_W5500
References:
W5500 Datasheet, Version 1.0.9, 2013 WIZnet Co., Ltd.
+if NET_W5500
+
+config NET_W5500_NINTERFACES
+ int "Number of physical W5500 devices"
+ default 1
+ range 1 1
Review Comment:
In this PR, that block was just moved inside the file, while adding options related to the switch. It had somehow ended up in the middle of ksz configs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11422:
URL: https://github.com/apache/nuttx/pull/11422#discussion_r1431689730
##########
drivers/net/ksz9477.c:
##########
@@ -36,6 +36,21 @@
* Private Data
****************************************************************************/
+#ifdef CONFIG_NET_KSZ9477_PORT_VLAN
+
+static uint8_t port_vlan_config[] =
Review Comment:
```suggestion
static uint8_t g_port_vlan_config[] =
```
##########
include/nuttx/net/ksz9477.h:
##########
@@ -91,6 +91,62 @@ int ksz9477_i2c_init(struct i2c_master_s *i2c_bus,
# error Only I2c interface currently supported
#endif
+/****************************************************************************
+ * Name: ksz9477_enable_port_vlan
+ *
+ * Description:
+ * Enables static port-based VLAN, which can be configured in the switch
+ * queue management's port control registers
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_enable_port_vlan(void);
+
+/****************************************************************************
+ * Name: ksz9477_disable_port_vlan
+ *
+ * Description:
+ * Disables the static port-based VLAN
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_disable_port_vlan(void);
+
+/****************************************************************************
+ * Name: ksz9477_configure_port_vlan
+ *
+ * Description:
+ * Configures the static port-based VLAN for a single port
+ * The change will become effective next time when the switch is
+ * initialized.
+ *
+ * Input Parameters:
+ * port: The port being configured (1-7)
+ * disable: Bitmask of ports where frames may not be forwarded to.
+ * Bit 0 is for port 1, bit 1 for port 2 etc.
+ * enable: Bitmask of ports where frames may be forwarded to.
+ * Bit 0 is for port 1, bit 1 for port 2 etc.
+ *
+ * Returned Value:
+ * OK or negative error number
+ *
+ ****************************************************************************/
+
+int ksz9477_configure_port_vlan(ksz9477_port_t port, uint8_t disable,
Review Comment:
why expose these functions publicly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "jlaitine (via GitHub)" <gi...@apache.org>.
jlaitine commented on code in PR #11422:
URL: https://github.com/apache/nuttx/pull/11422#discussion_r1431816914
##########
drivers/net/ksz9477.c:
##########
@@ -36,6 +36,21 @@
* Private Data
****************************************************************************/
+#ifdef CONFIG_NET_KSZ9477_PORT_VLAN
+
+static uint8_t port_vlan_config[] =
Review Comment:
sure, done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/net/ksz9477: Add simple port-based static VLAN configuration [nuttx]
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #11422:
URL: https://github.com/apache/nuttx/pull/11422#discussion_r1437916558
##########
drivers/net/Kconfig:
##########
@@ -392,6 +392,18 @@ menuconfig NET_W5500
References:
W5500 Datasheet, Version 1.0.9, 2013 WIZnet Co., Ltd.
+if NET_W5500
+
+config NET_W5500_NINTERFACES
+ int "Number of physical W5500 devices"
+ default 1
+ range 1 1
Review Comment:
Do we expect to extend maximum value (otherwise config option does not make sense)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org