1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
8 #include "otx2_ethdev.h"
11 parse_flow_max_priority(const char *key, const char *value, void *extra_args)
18 /* Limit the max priority to 32 */
19 if (val < 1 || val > 32)
22 *(uint16_t *)extra_args = val;
28 parse_flow_prealloc_size(const char *key, const char *value, void *extra_args)
35 /* Limit the prealloc size to 32 */
36 if (val < 1 || val > 32)
39 *(uint16_t *)extra_args = val;
45 parse_reta_size(const char *key, const char *value, void *extra_args)
52 if (val <= ETH_RSS_RETA_SIZE_64)
53 val = ETH_RSS_RETA_SIZE_64;
54 else if (val > ETH_RSS_RETA_SIZE_64 && val <= ETH_RSS_RETA_SIZE_128)
55 val = ETH_RSS_RETA_SIZE_128;
56 else if (val > ETH_RSS_RETA_SIZE_128 && val <= ETH_RSS_RETA_SIZE_256)
57 val = ETH_RSS_RETA_SIZE_256;
59 val = NIX_RSS_RETA_SIZE;
61 *(uint16_t *)extra_args = val;
67 parse_ptype_flag(const char *key, const char *value, void *extra_args)
74 val = 0; /* Disable NIX_RX_OFFLOAD_PTYPE_F */
76 *(uint16_t *)extra_args = val;
82 parse_flag(const char *key, const char *value, void *extra_args)
86 *(uint16_t *)extra_args = atoi(value);
92 parse_sqb_count(const char *key, const char *value, void *extra_args)
99 if (val < NIX_MIN_SQB || val > NIX_MAX_SQB)
102 *(uint16_t *)extra_args = val;
107 #define OTX2_RSS_RETA_SIZE "reta_size"
108 #define OTX2_PTYPE_DISABLE "ptype_disable"
109 #define OTX2_SCL_ENABLE "scalar_enable"
110 #define OTX2_MAX_SQB_COUNT "max_sqb_count"
111 #define OTX2_FLOW_PREALLOC_SIZE "flow_prealloc_size"
112 #define OTX2_FLOW_MAX_PRIORITY "flow_max_priority"
115 otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev)
117 uint16_t offload_flag = NIX_RX_OFFLOAD_PTYPE_F;
118 uint16_t rss_size = NIX_RSS_RETA_SIZE;
119 uint16_t sqb_count = NIX_MAX_SQB;
120 uint16_t flow_prealloc_size = 8;
121 uint16_t flow_max_priority = 3;
122 uint16_t scalar_enable = 0;
123 struct rte_kvargs *kvlist;
128 kvlist = rte_kvargs_parse(devargs->args, NULL);
132 rte_kvargs_process(kvlist, OTX2_PTYPE_DISABLE,
133 &parse_ptype_flag, &offload_flag);
134 rte_kvargs_process(kvlist, OTX2_RSS_RETA_SIZE,
135 &parse_reta_size, &rss_size);
136 rte_kvargs_process(kvlist, OTX2_SCL_ENABLE,
137 &parse_flag, &scalar_enable);
138 rte_kvargs_process(kvlist, OTX2_MAX_SQB_COUNT,
139 &parse_sqb_count, &sqb_count);
140 rte_kvargs_process(kvlist, OTX2_FLOW_PREALLOC_SIZE,
141 &parse_flow_prealloc_size, &flow_prealloc_size);
142 rte_kvargs_process(kvlist, OTX2_FLOW_MAX_PRIORITY,
143 &parse_flow_max_priority, &flow_max_priority);
144 rte_kvargs_free(kvlist);
147 dev->rx_offload_flags = offload_flag;
148 dev->scalar_ena = scalar_enable;
149 dev->max_sqb_count = sqb_count;
150 dev->rss_info.rss_size = rss_size;
151 dev->npc_flow.flow_prealloc_size = flow_prealloc_size;
152 dev->npc_flow.flow_max_priority = flow_max_priority;
159 RTE_PMD_REGISTER_PARAM_STRING(net_octeontx2,
160 OTX2_RSS_RETA_SIZE "=<64|128|256>"
161 OTX2_PTYPE_DISABLE "=1"
163 OTX2_MAX_SQB_COUNT "=<8-512>"
164 OTX2_FLOW_PREALLOC_SIZE "=<1-32>"
165 OTX2_FLOW_MAX_PRIORITY "=<1-32>");