linux/drivers/net/ethernet/microchip/sparx5/sparx5_qos.h

/* SPDX-License-Identifier: GPL-2.0+ */
/* Microchip Sparx5 Switch driver
 *
 * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
 */

#ifndef __SPARX5_QOS_H__
#define __SPARX5_QOS_H__

#include <linux/netdevice.h>

/* Number of Layers */
#define SPX5_HSCH_LAYER_CNT

/* Scheduling elements per layer */
#define SPX5_HSCH_L0_SE_CNT
#define SPX5_HSCH_L1_SE_CNT
#define SPX5_HSCH_L2_SE_CNT

/* Calculate Layer 0 Scheduler Element when using normal hierarchy */
#define SPX5_HSCH_L0_GET_IDX(port, queue)

/* Number of leak groups */
#define SPX5_HSCH_LEAK_GRP_CNT

/* Scheduler modes */
#define SPX5_SE_MODE_LINERATE
#define SPX5_SE_MODE_DATARATE

/* Rate and burst */
#define SPX5_SE_RATE_MAX
#define SPX5_SE_BURST_MAX
#define SPX5_SE_RATE_MIN
#define SPX5_SE_BURST_MIN
#define SPX5_SE_BURST_UNIT

/* Dwrr */
#define SPX5_DWRR_COST_MAX

struct sparx5_shaper {};

struct sparx5_lg {};

struct sparx5_layer {};

struct sparx5_dwrr {};

int sparx5_qos_init(struct sparx5 *sparx5);

/* Multi-Queue Priority */
int sparx5_tc_mqprio_add(struct net_device *ndev, u8 num_tc);
int sparx5_tc_mqprio_del(struct net_device *ndev);

/* Token Bucket Filter */
struct tc_tbf_qopt_offload_replace_params;
int sparx5_tc_tbf_add(struct sparx5_port *port,
		      struct tc_tbf_qopt_offload_replace_params *params,
		      u32 layer, u32 idx);
int sparx5_tc_tbf_del(struct sparx5_port *port, u32 layer, u32 idx);

/* Enhanced Transmission Selection */
struct tc_ets_qopt_offload_replace_params;
int sparx5_tc_ets_add(struct sparx5_port *port,
		      struct tc_ets_qopt_offload_replace_params *params);

int sparx5_tc_ets_del(struct sparx5_port *port);

#endif	/* __SPARX5_QOS_H__ */