From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <UNGLinuxDriver@microchip.com>,
<daniel.machon@microchip.com>, <piotr.raczynski@intel.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: [PATCH net-next v2 5/7] net: lan966x: Add support for offloading default prio
Date: Tue, 16 May 2023 22:14:06 +0200 [thread overview]
Message-ID: <20230516201408.3172428-6-horatiu.vultur@microchip.com> (raw)
In-Reply-To: <20230516201408.3172428-1-horatiu.vultur@microchip.com>
Add support for offloading default prio.
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Piotr Raczynski <piotr.raczynski@intel.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
.../ethernet/microchip/lan966x/lan966x_dcb.c | 12 +++++++++++
.../ethernet/microchip/lan966x/lan966x_main.h | 1 +
.../ethernet/microchip/lan966x/lan966x_port.c | 21 +++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_dcb.c b/drivers/net/ethernet/microchip/lan966x/lan966x_dcb.c
index 17cec9ec5ed25..273e3bfb23897 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_dcb.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_dcb.c
@@ -64,6 +64,11 @@ static void lan966x_dcb_app_update(struct net_device *dev)
qos.dscp.map[i] = dcb_getapp(dev, &app_itr);
}
+ /* Get default prio */
+ qos.default_prio = dcb_ieee_getapp_default_prio_mask(dev);
+ if (qos.default_prio)
+ qos.default_prio = fls(qos.default_prio) - 1;
+
/* Enable use of pcp for queue classification */
if (lan966x_dcb_apptrust_contains(port->chip_port, DCB_APP_SEL_PCP))
qos.pcp.enable = true;
@@ -106,6 +111,13 @@ static int lan966x_dcb_app_validate(struct net_device *dev,
int err = 0;
switch (app->selector) {
+ /* Default priority checks */
+ case IEEE_8021QAZ_APP_SEL_ETHERTYPE:
+ if (app->protocol)
+ err = -EINVAL;
+ else if (app->priority >= NUM_PRIO_QUEUES)
+ err = -ERANGE;
+ break;
/* Dscp checks */
case IEEE_8021QAZ_APP_SEL_DSCP:
if (app->protocol >= LAN966X_PORT_QOS_DSCP_COUNT)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
index 8213440e08672..53711d5380166 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
@@ -412,6 +412,7 @@ struct lan966x_port_qos_dscp {
struct lan966x_port_qos {
struct lan966x_port_qos_pcp pcp;
struct lan966x_port_qos_dscp dscp;
+ u8 default_prio;
};
struct lan966x_port {
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_port.c b/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
index 11c552e87ee44..a6608876b71ef 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
@@ -443,11 +443,32 @@ static void lan966x_port_qos_dscp_set(struct lan966x_port *port,
lan966x, ANA_DSCP_CFG(i));
}
+static int lan966x_port_qos_default_set(struct lan966x_port *port,
+ struct lan966x_port_qos *qos)
+{
+ /* Set default prio and dp level */
+ lan_rmw(ANA_QOS_CFG_DP_DEFAULT_VAL_SET(0) |
+ ANA_QOS_CFG_QOS_DEFAULT_VAL_SET(qos->default_prio),
+ ANA_QOS_CFG_DP_DEFAULT_VAL |
+ ANA_QOS_CFG_QOS_DEFAULT_VAL,
+ port->lan966x, ANA_QOS_CFG(port->chip_port));
+
+ /* Set default pcp and dei for untagged frames */
+ lan_rmw(ANA_VLAN_CFG_VLAN_DEI_SET(0) |
+ ANA_VLAN_CFG_VLAN_PCP_SET(0),
+ ANA_VLAN_CFG_VLAN_DEI |
+ ANA_VLAN_CFG_VLAN_PCP,
+ port->lan966x, ANA_VLAN_CFG(port->chip_port));
+
+ return 0;
+}
+
void lan966x_port_qos_set(struct lan966x_port *port,
struct lan966x_port_qos *qos)
{
lan966x_port_qos_pcp_set(port, &qos->pcp);
lan966x_port_qos_dscp_set(port, &qos->dscp);
+ lan966x_port_qos_default_set(port, qos);
}
void lan966x_port_init(struct lan966x_port *port)
--
2.38.0
next prev parent reply other threads:[~2023-05-16 20:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 20:14 [PATCH net-next v2 0/7] net: lan966x: Add support for PCP, DEI, DSCP Horatiu Vultur
2023-05-16 20:14 ` [PATCH net-next v2 1/7] net: lan966x: Add registers to configure " Horatiu Vultur
2023-05-16 20:14 ` [PATCH net-next v2 2/7] net: lan966x: Add support for offloading pcp table Horatiu Vultur
2023-05-16 20:14 ` [PATCH net-next v2 3/7] net: lan966x: Add support for apptrust Horatiu Vultur
2023-05-16 20:14 ` [PATCH net-next v2 4/7] net: lan966x: Add support for offloading dscp table Horatiu Vultur
2023-05-16 20:14 ` Horatiu Vultur [this message]
2023-05-16 20:14 ` [PATCH net-next v2 6/7] net: lan966x: Add support for PCP rewrite Horatiu Vultur
2023-05-16 20:14 ` [PATCH net-next v2 7/7] net: lan966x: Add support for DSCP rewrite Horatiu Vultur
2023-05-18 13:50 ` [PATCH net-next v2 0/7] net: lan966x: Add support for PCP, DEI, DSCP patchwork-bot+netdevbpf
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=20230516201408.3172428-6-horatiu.vultur@microchip.com \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=piotr.raczynski@intel.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
all inboxes | Powered by JetHome®