Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes
@ 2024-05-10  5:38 Oleksij Rempel
  2024-05-10  5:38 ` [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM Oleksij Rempel
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Oleksij Rempel @ 2024-05-10  5:38 UTC (permalink / raw
  To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Simon Horman, Willem de Bruijn, Søren Andersen

This patch series address recommendation to rename IPV to IPM to avoid
confusion with IPV name used in 802.1Qci PSFP. And restores default "PCP
only" configuration as source of priorities to avoid possible
regressions. 

change logs are in separate patches.

Oleksij Rempel (3):
  net: dsa: microchip: dcb: rename IPV to IPM
  net: dsa: microchip: dcb: add comments for DSCP related functions
  net: dsa: microchip: dcb: set default apptrust to PCP only

 drivers/net/dsa/microchip/ksz_common.c |  46 +++++------
 drivers/net/dsa/microchip/ksz_common.h |   2 +-
 drivers/net/dsa/microchip/ksz_dcb.c    | 106 ++++++++++++++-----------
 3 files changed, 85 insertions(+), 69 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM
  2024-05-10  5:38 [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes Oleksij Rempel
@ 2024-05-10  5:38 ` Oleksij Rempel
  2024-05-10 12:28   ` Simon Horman
  2024-05-10  5:38 ` [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions Oleksij Rempel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2024-05-10  5:38 UTC (permalink / raw
  To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss
  Cc: Oleksij Rempel, Woojung Huh, kernel, linux-kernel, netdev,
	UNGLinuxDriver, David Ahern, Simon Horman, Willem de Bruijn,
	Søren Andersen

IPV is added and used term in 802.1Qci PSFP and merged into 802.1Q (from
802.1Q-2018) for another functions.

Even it does similar operation holding temporal priority value
internally (as it is named), because KSZ datasheet doesn't use the term
of IPV (Internal Priority Value) and avoiding any confusion later when
PSFP is in the Linux world, it is better to rename IPV to IPM (Internal
Priority Mapping).

In addition, LAN937x documentation already use IPV for 802.1Qci PSFP
related functionality.

Suggested-by: Woojung Huh <Woojung.Huh@microchip.com>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Woojung Huh <woojung.huh@microchip.com>
---
changes v3:
- fix compile error
changes v2:
- s/Value/Map
---
 drivers/net/dsa/microchip/ksz_common.c | 46 +++++++++++-----------
 drivers/net/dsa/microchip/ksz_common.h |  2 +-
 drivers/net/dsa/microchip/ksz_dcb.c    | 54 +++++++++++++-------------
 3 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 95622dec2b28a..eac4be9d9d055 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1227,7 +1227,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 3,		/* total port count */
 		.port_nirqs = 3,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
@@ -1257,7 +1257,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.cpu_ports = 0x10,	/* can be configured as cpu port */
 		.port_cnt = 5,		/* total cpu and user ports */
 		.num_tx_queues = 4,
-		.num_ipvs = 4,
+		.num_ipms = 4,
 		.ops = &ksz8_dev_ops,
 		.phylink_mac_ops = &ksz8_phylink_mac_ops,
 		.ksz87xx_eee_link_erratum = true,
@@ -1298,7 +1298,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.cpu_ports = 0x10,	/* can be configured as cpu port */
 		.port_cnt = 5,		/* total cpu and user ports */
 		.num_tx_queues = 4,
-		.num_ipvs = 4,
+		.num_ipms = 4,
 		.ops = &ksz8_dev_ops,
 		.phylink_mac_ops = &ksz8_phylink_mac_ops,
 		.ksz87xx_eee_link_erratum = true,
@@ -1325,7 +1325,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.cpu_ports = 0x10,	/* can be configured as cpu port */
 		.port_cnt = 5,		/* total cpu and user ports */
 		.num_tx_queues = 4,
-		.num_ipvs = 4,
+		.num_ipms = 4,
 		.ops = &ksz8_dev_ops,
 		.phylink_mac_ops = &ksz8_phylink_mac_ops,
 		.ksz87xx_eee_link_erratum = true,
@@ -1352,7 +1352,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.cpu_ports = 0x4,	/* can be configured as cpu port */
 		.port_cnt = 3,
 		.num_tx_queues = 4,
-		.num_ipvs = 4,
+		.num_ipms = 4,
 		.ops = &ksz8_dev_ops,
 		.phylink_mac_ops = &ksz8830_phylink_mac_ops,
 		.mib_names = ksz88xx_mib_names,
@@ -1378,7 +1378,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 7,		/* total physical port count */
 		.port_nirqs = 4,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
@@ -1413,7 +1413,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 6,		/* total physical port count */
 		.port_nirqs = 2,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
 		.mib_names = ksz9477_mib_names,
@@ -1447,7 +1447,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 7,		/* total physical port count */
 		.port_nirqs = 2,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
 		.mib_names = ksz9477_mib_names,
@@ -1479,7 +1479,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 3,		/* total port count */
 		.port_nirqs = 2,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
 		.mib_names = ksz9477_mib_names,
@@ -1507,7 +1507,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 3,		/* total port count */
 		.port_nirqs = 3,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
@@ -1536,7 +1536,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 7,		/* total port count */
 		.port_nirqs = 3,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &ksz9477_dev_ops,
 		.phylink_mac_ops = &ksz9477_phylink_mac_ops,
@@ -1570,7 +1570,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 7,		/* total physical port count */
 		.port_nirqs = 3,
 		.num_tx_queues = 4,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &ksz9477_dev_ops,
 		.mib_names = ksz9477_mib_names,
@@ -1602,7 +1602,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 5,		/* total physical port count */
 		.port_nirqs = 6,
 		.num_tx_queues = 8,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &lan937x_dev_ops,
 		.phylink_mac_ops = &lan937x_phylink_mac_ops,
@@ -1630,7 +1630,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 6,		/* total physical port count */
 		.port_nirqs = 6,
 		.num_tx_queues = 8,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &lan937x_dev_ops,
 		.phylink_mac_ops = &lan937x_phylink_mac_ops,
@@ -1658,7 +1658,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 8,		/* total physical port count */
 		.port_nirqs = 6,
 		.num_tx_queues = 8,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &lan937x_dev_ops,
 		.phylink_mac_ops = &lan937x_phylink_mac_ops,
@@ -1690,7 +1690,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 5,		/* total physical port count */
 		.port_nirqs = 6,
 		.num_tx_queues = 8,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &lan937x_dev_ops,
 		.phylink_mac_ops = &lan937x_phylink_mac_ops,
@@ -1722,7 +1722,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.port_cnt = 8,		/* total physical port count */
 		.port_nirqs = 6,
 		.num_tx_queues = 8,
-		.num_ipvs = 8,
+		.num_ipms = 8,
 		.tc_cbs_supported = true,
 		.ops = &lan937x_dev_ops,
 		.phylink_mac_ops = &lan937x_phylink_mac_ops,
@@ -2726,20 +2726,20 @@ static int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev,
 						  int port)
 {
 	u32 queue_map = 0;
-	int ipv;
+	int ipm;
 
-	for (ipv = 0; ipv < dev->info->num_ipvs; ipv++) {
+	for (ipm = 0; ipm < dev->info->num_ipms; ipm++) {
 		int queue;
 
 		/* Traffic Type (TT) is corresponding to the Internal Priority
-		 * Value (IPV) in the switch. Traffic Class (TC) is
+		 * Map (IPM) in the switch. Traffic Class (TC) is
 		 * corresponding to the queue in the switch.
 		 */
-		queue = ieee8021q_tt_to_tc(ipv, dev->info->num_tx_queues);
+		queue = ieee8021q_tt_to_tc(ipm, dev->info->num_tx_queues);
 		if (queue < 0)
 			return queue;
 
-		queue_map |= queue << (ipv * KSZ9477_PORT_TC_MAP_S);
+		queue_map |= queue << (ipm * KSZ9477_PORT_TC_MAP_S);
 	}
 
 	return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4, queue_map);
@@ -3609,7 +3609,7 @@ static int ksz_tc_ets_add(struct ksz_device *dev, int port,
 	for (tc_prio = 0; tc_prio < ARRAY_SIZE(p->priomap); tc_prio++) {
 		int queue;
 
-		if (tc_prio >= dev->info->num_ipvs)
+		if (tc_prio >= dev->info->num_ipms)
 			break;
 
 		queue = ksz_ets_band_to_queue(p, p->priomap[tc_prio]);
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index baf236792e107..c784fd23a9937 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -62,7 +62,7 @@ struct ksz_chip_data {
 	int port_cnt;
 	u8 port_nirqs;
 	u8 num_tx_queues;
-	u8 num_ipvs; /* number of Internal Priority Values */
+	u8 num_ipms; /* number of Internal Priority Maps */
 	bool tc_cbs_supported;
 	const struct ksz_dev_ops *ops;
 	const struct phylink_mac_ops *phylink_mac_ops;
diff --git a/drivers/net/dsa/microchip/ksz_dcb.c b/drivers/net/dsa/microchip/ksz_dcb.c
index 5e520c02afd72..af7af515e0434 100644
--- a/drivers/net/dsa/microchip/ksz_dcb.c
+++ b/drivers/net/dsa/microchip/ksz_dcb.c
@@ -52,7 +52,7 @@ static const struct ksz_apptrust_map ksz9477_apptrust_map_to_bit[] = {
 };
 
 /* ksz_supported_apptrust[] - Supported apptrust selectors and Priority Order
- *			      of Internal Priority Value (IPV) sources.
+ *			      of Internal Priority Map (IPM) sources.
  *
  * This array defines the apptrust selectors supported by the hardware, where
  * the index within the array indicates the priority of the selector - lower
@@ -246,7 +246,7 @@ int ksz_port_set_default_prio(struct dsa_switch *ds, int port, u8 prio)
 	int reg, shift, ret;
 	u8 mask;
 
-	if (prio >= dev->info->num_ipvs)
+	if (prio >= dev->info->num_ipms)
 		return -EINVAL;
 
 	if (ksz_is_ksz88x3(dev)) {
@@ -282,7 +282,7 @@ int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp)
 	ksz_get_dscp_prio_reg(dev, &reg, &per_reg, &mask);
 
 	/* If DSCP remapping is disabled, DSCP bits 3-5 are used as Internal
-	 * Priority Value (IPV)
+	 * Priority Map (IPM)
 	 */
 	if (!is_ksz8(dev)) {
 		ret = ksz_read8(dev, KSZ9477_REG_SW_MAC_TOS_CTRL, &data);
@@ -290,7 +290,7 @@ int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp)
 			return ret;
 
 		/* If DSCP remapping is disabled, DSCP bits 3-5 are used as
-		 * Internal Priority Value (IPV)
+		 * Internal Priority Map (IPM)
 		 */
 		if (!(data & KSZ9477_SW_TOS_DSCP_REMAP))
 			return FIELD_GET(KSZ9477_SW_TOS_DSCP_DEFAULT_PRIO_M,
@@ -310,7 +310,7 @@ int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp)
 	return (data >> shift) & mask;
 }
 
-static int ksz_set_global_dscp_entry(struct ksz_device *dev, u8 dscp, u8 ipv)
+static int ksz_set_global_dscp_entry(struct ksz_device *dev, u8 dscp, u8 ipm)
 {
 	int reg, per_reg, shift;
 	u8 mask;
@@ -320,7 +320,7 @@ static int ksz_set_global_dscp_entry(struct ksz_device *dev, u8 dscp, u8 ipv)
 	shift = (dscp % per_reg) * (8 / per_reg);
 
 	return ksz_rmw8(dev, reg + (dscp / per_reg), mask << shift,
-			ipv << shift);
+			ipm << shift);
 }
 
 /**
@@ -349,15 +349,15 @@ static int ksz_init_global_dscp_map(struct ksz_device *dev)
 	}
 
 	for (dscp = 0; dscp < DSCP_MAX; dscp++) {
-		int ipv, tt;
+		int ipm, tt;
 
 		/* Map DSCP to Traffic Type, which is corresponding to the
-		 * Internal Priority Value (IPV) in the switch.
+		 * Internal Priority Map (IPM) in the switch.
 		 */
 		if (!is_ksz8(dev)) {
-			ipv = ietf_dscp_to_ieee8021q_tt(dscp);
+			ipm = ietf_dscp_to_ieee8021q_tt(dscp);
 		} else {
-			/* On KSZ8xxx variants we do not have IPV to queue
+			/* On KSZ8xxx variants we do not have IPM to queue
 			 * remapping table. We need to convert DSCP to Traffic
 			 * Type and then to queue.
 			 */
@@ -365,13 +365,13 @@ static int ksz_init_global_dscp_map(struct ksz_device *dev)
 			if (tt < 0)
 				return tt;
 
-			ipv = ieee8021q_tt_to_tc(tt, dev->info->num_tx_queues);
+			ipm = ieee8021q_tt_to_tc(tt, dev->info->num_tx_queues);
 		}
 
-		if (ipv < 0)
-			return ipv;
+		if (ipm < 0)
+			return ipm;
 
-		ret = ksz_set_global_dscp_entry(dev, dscp, ipv);
+		ret = ksz_set_global_dscp_entry(dev, dscp, ipm);
 	}
 
 	return 0;
@@ -381,7 +381,7 @@ int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 {
 	struct ksz_device *dev = ds->priv;
 
-	if (prio >= dev->info->num_ipvs)
+	if (prio >= dev->info->num_ipms)
 		return -ERANGE;
 
 	return ksz_set_global_dscp_entry(dev, dscp, prio);
@@ -390,21 +390,21 @@ int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 int ksz_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 {
 	struct ksz_device *dev = ds->priv;
-	int ipv;
+	int ipm;
 
 	if (ksz_port_get_dscp_prio(ds, port, dscp) != prio)
 		return 0;
 
 	if (is_ksz8(dev)) {
-		ipv = ieee8021q_tt_to_tc(IEEE8021Q_TT_BE,
+		ipm = ieee8021q_tt_to_tc(IEEE8021Q_TT_BE,
 					 dev->info->num_tx_queues);
-		if (ipv < 0)
-			return ipv;
+		if (ipm < 0)
+			return ipm;
 	} else {
-		ipv = IEEE8021Q_TT_BE;
+		ipm = IEEE8021Q_TT_BE;
 	}
 
-	return ksz_set_global_dscp_entry(dev, dscp, ipv);
+	return ksz_set_global_dscp_entry(dev, dscp, ipm);
 }
 
 /**
@@ -741,20 +741,20 @@ int ksz_port_get_apptrust(struct dsa_switch *ds, int port, u8 *sel, int *nsel)
 int ksz_dcb_init_port(struct ksz_device *dev, int port)
 {
 	const u8 *sel;
-	int ret, ipv;
+	int ret, ipm;
 	int sel_len;
 
 	if (is_ksz8(dev)) {
-		ipv = ieee8021q_tt_to_tc(IEEE8021Q_TT_BE,
+		ipm = ieee8021q_tt_to_tc(IEEE8021Q_TT_BE,
 					 dev->info->num_tx_queues);
-		if (ipv < 0)
-			return ipv;
+		if (ipm < 0)
+			return ipm;
 	} else {
-		ipv = IEEE8021Q_TT_BE;
+		ipm = IEEE8021Q_TT_BE;
 	}
 
 	/* Set the default priority for the port to Best Effort */
-	ret = ksz_port_set_default_prio(dev->ds, port, ipv);
+	ret = ksz_port_set_default_prio(dev->ds, port, ipm);
 	if (ret)
 		return ret;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions
  2024-05-10  5:38 [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes Oleksij Rempel
  2024-05-10  5:38 ` [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM Oleksij Rempel
@ 2024-05-10  5:38 ` Oleksij Rempel
  2024-05-10 12:29   ` Simon Horman
  2024-05-10  5:38 ` [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only Oleksij Rempel
  2024-05-13 23:10 ` [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2024-05-10  5:38 UTC (permalink / raw
  To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Simon Horman, Willem de Bruijn, Søren Andersen

All other functions are commented. Add missing comments to following
functions:
ksz_set_global_dscp_entry()
ksz_port_add_dscp_prio()
ksz_port_del_dscp_prio()

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
changes v2:
- move this patch after IPV->IPM rename patch
---
 drivers/net/dsa/microchip/ksz_dcb.c | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/net/dsa/microchip/ksz_dcb.c b/drivers/net/dsa/microchip/ksz_dcb.c
index af7af515e0434..07f6742df41bd 100644
--- a/drivers/net/dsa/microchip/ksz_dcb.c
+++ b/drivers/net/dsa/microchip/ksz_dcb.c
@@ -310,6 +310,17 @@ int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp)
 	return (data >> shift) & mask;
 }
 
+/**
+ * ksz_set_global_dscp_entry - Sets the global DSCP-to-priority mapping entry
+ * @dev: Pointer to the KSZ switch device structure
+ * @dscp: DSCP value for which to set the priority
+ * @ipm: Priority value to set
+ *
+ * This function sets the global DSCP-to-priority mapping entry for the
+ * specified DSCP value.
+ *
+ * Return: 0 on success, or a negative error code on failure.
+ */
 static int ksz_set_global_dscp_entry(struct ksz_device *dev, u8 dscp, u8 ipm)
 {
 	int reg, per_reg, shift;
@@ -377,6 +388,16 @@ static int ksz_init_global_dscp_map(struct ksz_device *dev)
 	return 0;
 }
 
+/**
+ * ksz_port_add_dscp_prio - Adds a DSCP-to-priority mapping entry for a port on
+ *			    a KSZ switch.
+ * @ds: Pointer to the DSA switch structure
+ * @port: Port number for which to add the DSCP-to-priority mapping entry
+ * @dscp: DSCP value for which to add the priority
+ * @prio: Priority value to set
+ *
+ * Return: 0 on success, or a negative error code on failure
+ */
 int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 {
 	struct ksz_device *dev = ds->priv;
@@ -387,6 +408,16 @@ int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 	return ksz_set_global_dscp_entry(dev, dscp, prio);
 }
 
+/**
+ * ksz_port_del_dscp_prio - Deletes a DSCP-to-priority mapping entry for a port
+ *			    on a KSZ switch.
+ * @ds: Pointer to the DSA switch structure
+ * @port: Port number for which to delete the DSCP-to-priority mapping entry
+ * @dscp: DSCP value for which to delete the priority
+ * @prio: Priority value to delete
+ *
+ * Return: 0 on success, or a negative error code on failure
+ */
 int ksz_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio)
 {
 	struct ksz_device *dev = ds->priv;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only
  2024-05-10  5:38 [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes Oleksij Rempel
  2024-05-10  5:38 ` [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM Oleksij Rempel
  2024-05-10  5:38 ` [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions Oleksij Rempel
@ 2024-05-10  5:38 ` Oleksij Rempel
  2024-05-10 12:29   ` Simon Horman
  2024-05-13 23:10 ` [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2024-05-10  5:38 UTC (permalink / raw
  To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Simon Horman, Willem de Bruijn, Søren Andersen

Before DCB support, the KSZ driver had only PCP as source of packet
priority values. To avoid regressions, make PCP only as default value.
User will need enable DSCP support manually.

This patch do not affect other KSZ8 related quirks. User will still be
warned by setting not support configurations for the port 2.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
 drivers/net/dsa/microchip/ksz_dcb.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_dcb.c b/drivers/net/dsa/microchip/ksz_dcb.c
index 07f6742df41bd..dfe2c48e1066a 100644
--- a/drivers/net/dsa/microchip/ksz_dcb.c
+++ b/drivers/net/dsa/microchip/ksz_dcb.c
@@ -82,10 +82,6 @@ static const u8 ksz_supported_apptrust[] = {
 	IEEE_8021QAZ_APP_SEL_DSCP,
 };
 
-static const u8 ksz8_port2_supported_apptrust[] = {
-	DCB_APP_SEL_PCP,
-};
-
 static const char * const ksz_supported_apptrust_variants[] = {
 	"empty", "dscp", "pcp", "dscp pcp"
 };
@@ -771,9 +767,8 @@ int ksz_port_get_apptrust(struct dsa_switch *ds, int port, u8 *sel, int *nsel)
  */
 int ksz_dcb_init_port(struct ksz_device *dev, int port)
 {
-	const u8 *sel;
+	const u8 ksz_default_apptrust[] = { DCB_APP_SEL_PCP };
 	int ret, ipm;
-	int sel_len;
 
 	if (is_ksz8(dev)) {
 		ipm = ieee8021q_tt_to_tc(IEEE8021Q_TT_BE,
@@ -789,18 +784,8 @@ int ksz_dcb_init_port(struct ksz_device *dev, int port)
 	if (ret)
 		return ret;
 
-	if (ksz_is_ksz88x3(dev) && port == KSZ_PORT_2) {
-		/* KSZ88x3 devices do not support DSCP classification on
-		 * "Port 2.
-		 */
-		sel = ksz8_port2_supported_apptrust;
-		sel_len = ARRAY_SIZE(ksz8_port2_supported_apptrust);
-	} else {
-		sel = ksz_supported_apptrust;
-		sel_len = ARRAY_SIZE(ksz_supported_apptrust);
-	}
-
-	return ksz_port_set_apptrust(dev->ds, port, sel, sel_len);
+	return ksz_port_set_apptrust(dev->ds, port, ksz_default_apptrust,
+				     ARRAY_SIZE(ksz_default_apptrust));
 }
 
 /**
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM
  2024-05-10  5:38 ` [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM Oleksij Rempel
@ 2024-05-10 12:28   ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-05-10 12:28 UTC (permalink / raw
  To: Oleksij Rempel
  Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Willem de Bruijn, Søren Andersen

On Fri, May 10, 2024 at 07:38:26AM +0200, Oleksij Rempel wrote:
> IPV is added and used term in 802.1Qci PSFP and merged into 802.1Q (from
> 802.1Q-2018) for another functions.
> 
> Even it does similar operation holding temporal priority value
> internally (as it is named), because KSZ datasheet doesn't use the term
> of IPV (Internal Priority Value) and avoiding any confusion later when
> PSFP is in the Linux world, it is better to rename IPV to IPM (Internal
> Priority Mapping).
> 
> In addition, LAN937x documentation already use IPV for 802.1Qci PSFP
> related functionality.
> 
> Suggested-by: Woojung Huh <Woojung.Huh@microchip.com>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Reviewed-by: Woojung Huh <woojung.huh@microchip.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions
  2024-05-10  5:38 ` [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions Oleksij Rempel
@ 2024-05-10 12:29   ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-05-10 12:29 UTC (permalink / raw
  To: Oleksij Rempel
  Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Willem de Bruijn, Søren Andersen

On Fri, May 10, 2024 at 07:38:27AM +0200, Oleksij Rempel wrote:
> All other functions are commented. Add missing comments to following
> functions:
> ksz_set_global_dscp_entry()
> ksz_port_add_dscp_prio()
> ksz_port_del_dscp_prio()
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>

Thanks,

I really appreciate attention to this detail.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only
  2024-05-10  5:38 ` [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only Oleksij Rempel
@ 2024-05-10 12:29   ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-05-10 12:29 UTC (permalink / raw
  To: Oleksij Rempel
  Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
	Arun Ramadoss, kernel, linux-kernel, netdev, UNGLinuxDriver,
	David Ahern, Willem de Bruijn, Søren Andersen

On Fri, May 10, 2024 at 07:38:28AM +0200, Oleksij Rempel wrote:
> Before DCB support, the KSZ driver had only PCP as source of packet
> priority values. To avoid regressions, make PCP only as default value.
> User will need enable DSCP support manually.
> 
> This patch do not affect other KSZ8 related quirks. User will still be
> warned by setting not support configurations for the port 2.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes
  2024-05-10  5:38 [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes Oleksij Rempel
                   ` (2 preceding siblings ...)
  2024-05-10  5:38 ` [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only Oleksij Rempel
@ 2024-05-13 23:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-13 23:10 UTC (permalink / raw
  To: Oleksij Rempel
  Cc: davem, andrew, edumazet, f.fainelli, kuba, pabeni, olteanv,
	woojung.huh, arun.ramadoss, kernel, linux-kernel, netdev,
	UNGLinuxDriver, dsahern, horms, willemb, san

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 10 May 2024 07:38:25 +0200 you wrote:
> This patch series address recommendation to rename IPV to IPM to avoid
> confusion with IPV name used in 802.1Qci PSFP. And restores default "PCP
> only" configuration as source of priorities to avoid possible
> regressions.
> 
> change logs are in separate patches.
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/3] net: dsa: microchip: dcb: rename IPV to IPM
    https://git.kernel.org/netdev/net-next/c/2ccb1ac2d018
  - [net-next,v3,2/3] net: dsa: microchip: dcb: add comments for DSCP related functions
    https://git.kernel.org/netdev/net-next/c/593d6ad1ef43
  - [net-next,v3,3/3] net: dsa: microchip: dcb: set default apptrust to PCP only
    https://git.kernel.org/netdev/net-next/c/01e400f29c91

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-13 23:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-10  5:38 [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes Oleksij Rempel
2024-05-10  5:38 ` [PATCH net-next v3 1/3] net: dsa: microchip: dcb: rename IPV to IPM Oleksij Rempel
2024-05-10 12:28   ` Simon Horman
2024-05-10  5:38 ` [PATCH net-next v3 2/3] net: dsa: microchip: dcb: add comments for DSCP related functions Oleksij Rempel
2024-05-10 12:29   ` Simon Horman
2024-05-10  5:38 ` [PATCH net-next v3 3/3] net: dsa: microchip: dcb: set default apptrust to PCP only Oleksij Rempel
2024-05-10 12:29   ` Simon Horman
2024-05-13 23:10 ` [PATCH net-next v3 0/3] net: dsa: microchip: DCB fixes patchwork-bot+netdevbpf

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 read-only IMAP folder(s) and NNTP newsgroup(s).