2022-09-20 12:14:28 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
/* Microchip Sparx5 Switch driver
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-09-20 12:14:29 +02:00
|
|
|
#include <net/pkt_cls.h>
|
|
|
|
|
|
2022-09-20 12:14:28 +02:00
|
|
|
#include "sparx5_tc.h"
|
|
|
|
|
#include "sparx5_main.h"
|
2022-09-20 12:14:29 +02:00
|
|
|
#include "sparx5_qos.h"
|
|
|
|
|
|
|
|
|
|
static int sparx5_tc_setup_qdisc_mqprio(struct net_device *ndev,
|
|
|
|
|
struct tc_mqprio_qopt_offload *m)
|
|
|
|
|
{
|
|
|
|
|
m->qopt.hw = TC_MQPRIO_HW_OFFLOAD_TCS;
|
|
|
|
|
|
|
|
|
|
if (m->qopt.num_tc == 0)
|
|
|
|
|
return sparx5_tc_mqprio_del(ndev);
|
|
|
|
|
else
|
|
|
|
|
return sparx5_tc_mqprio_add(ndev, m->qopt.num_tc);
|
|
|
|
|
}
|
2022-09-20 12:14:28 +02:00
|
|
|
|
|
|
|
|
int sparx5_port_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
|
|
|
|
void *type_data)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
2022-09-20 12:14:29 +02:00
|
|
|
case TC_SETUP_QDISC_MQPRIO:
|
|
|
|
|
return sparx5_tc_setup_qdisc_mqprio(ndev, type_data);
|
2022-09-20 12:14:28 +02:00
|
|
|
default:
|
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|