net/mvpp2: adjust number of unicast address
[dpdk.git] / drivers / net / mvpp2 / mrvl_qos.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Marvell International Ltd.
3  * Copyright(c) 2017 Semihalf.
4  * All rights reserved.
5  */
6
7 #ifndef _MRVL_QOS_H_
8 #define _MRVL_QOS_H_
9
10 #include <rte_common.h>
11
12 #include "mrvl_ethdev.h"
13
14 /** Code Points per Traffic Class. Equals max(DSCP, PCP). */
15 #define MRVL_CP_PER_TC (64)
16
17 /** Value used as "unknown". */
18 #define MRVL_UNKNOWN_TC (0xFF)
19
20 /* QoS config. */
21 struct mrvl_qos_cfg {
22         struct port_cfg {
23                 enum pp2_ppio_eth_start_hdr eth_start_hdr;
24                 int rate_limit_enable;
25                 struct pp2_ppio_rate_limit_params rate_limit_params;
26                 struct {
27                         uint8_t inq[MRVL_PP2_RXQ_MAX];
28                         uint8_t dscp[MRVL_CP_PER_TC];
29                         uint8_t pcp[MRVL_CP_PER_TC];
30                         uint8_t inqs;
31                         uint8_t dscps;
32                         uint8_t pcps;
33                         enum pp2_ppio_color color;
34                 } tc[MRVL_PP2_TC_MAX];
35                 struct {
36                         enum pp2_ppio_outq_sched_mode sched_mode;
37                         uint8_t weight;
38                         int rate_limit_enable;
39                         struct pp2_ppio_rate_limit_params rate_limit_params;
40                 } outq[MRVL_PP2_RXQ_MAX];
41                 enum pp2_cls_qos_tbl_type mapping_priority;
42                 uint16_t inqs;
43                 uint16_t outqs;
44                 uint8_t default_tc;
45                 uint8_t use_global_defaults;
46                 struct pp2_cls_plcr_params policer_params;
47                 uint8_t setup_policer;
48         } port[RTE_MAX_ETHPORTS];
49 };
50
51 /** Global QoS configuration. */
52 extern struct mrvl_qos_cfg *mrvl_qos_cfg;
53
54 /**
55  * Parse QoS configuration - rte_kvargs_process handler.
56  *
57  * Opens configuration file and parses its content.
58  *
59  * @param key Unused.
60  * @param path Path to config file.
61  * @param extra_args Pointer to configuration structure.
62  * @returns 0 in case of success, exits otherwise.
63  */
64 int
65 mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
66                 void *extra_args);
67
68 /**
69  * Configure RX Queues in a given port.
70  *
71  * Sets up RX queues, their Traffic Classes and DPDK rxq->(TC,inq) mapping.
72  *
73  * @param priv Port's private data
74  * @param portid DPDK port ID
75  * @param max_queues Maximum number of queues to configure.
76  * @returns 0 in case of success, negative value otherwise.
77  */
78 int
79 mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
80                     uint16_t max_queues);
81
82 /**
83  * Configure TX Queues in a given port.
84  *
85  * Sets up TX queues egress scheduler and limiter.
86  *
87  * @param priv Port's private data
88  * @param portid DPDK port ID
89  * @param max_queues Maximum number of queues to configure.
90  * @returns 0 in case of success, negative value otherwise.
91  */
92 int
93 mrvl_configure_txqs(struct mrvl_priv *priv, uint16_t portid,
94                     uint16_t max_queues);
95
96 /**
97  * Start QoS mapping.
98  *
99  * Finalize QoS table configuration and initialize it in SDK. It can be done
100  * only after port is started, so we have a valid ppio reference.
101  *
102  * @param priv Port's private (configuration) data.
103  * @returns 0 in case of success, exits otherwise.
104  */
105 int
106 mrvl_start_qos_mapping(struct mrvl_priv *priv);
107
108 #endif /* _MRVL_QOS_H_ */