Skip to content

Commit d90786b

Browse files
shaibranferruhy
authored andcommitted
net/ena: restructure LLQ policy user setting
Replaced `enable_llq`, `normal_llq_hdr` and `large_llq_hdr` devargs with a new shared devarg named `llq_policy` that implements the same logic and accepts the following values: 0 - Disable LLQ. Use with extreme caution as it leads to a huge performance degradation on AWS instances built with Nitro v4 onwards. 1 - Accept device recommended LLQ policy (Default). Device can recommend normal or large LLQ policy. 2 - Enforce normal LLQ policy. 3 - Enforce large LLQ policy. Required for packets with header that exceed 96 bytes on AWS instances built with Nitro v2 and earlier. Signed-off-by: Shai Brandes <[email protected]> Reviewed-by: Amit Bernstein <[email protected]>
1 parent d2b7539 commit d90786b

File tree

4 files changed

+51
-82
lines changed

4 files changed

+51
-82
lines changed

doc/guides/nics/ena.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,18 @@ Configuration
107107
Runtime Configuration
108108
^^^^^^^^^^^^^^^^^^^^^
109109

110-
* **large_llq_hdr** (default 0)
110+
* **llq_policy** (default 1)
111111

112-
Enables or disables usage of large LLQ headers. This option will have
113-
effect only if the device also supports large LLQ headers. Otherwise, the
114-
default value will be used.
112+
Controls whether use device recommended header policy or override it:
113+
114+
0 - Disable LLQ (Use with extreme caution as it leads to a huge performance
115+
degradation on AWS instances built with Nitro v4 onwards).
116+
117+
1 - Accept device recommended LLQ policy (Default).
118+
119+
2 - Enforce normal LLQ policy.
120+
121+
3 - Enforce large LLQ policy.
115122

116123
* **normal_llq_hdr** (default 0)
117124

@@ -126,15 +133,6 @@ Runtime Configuration
126133
timer service. Setting this parameter to 0 disables this feature. Maximum
127134
allowed value is 60 seconds.
128135

129-
* **enable_llq** (default 1)
130-
131-
Determines whenever the driver should use the LLQ (if it's available) or
132-
not.
133-
134-
**NOTE: On the 6th generation AWS instances disabling LLQ may lead to a
135-
huge performance degradation. In general disabling LLQ is highly not
136-
recommended!**
137-
138136
* **control_poll_interval** (default 0)
139137

140138
Enable polling-based functionality of the admin queues,

doc/guides/rel_notes/release_24_11.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ New Features
8787
registers by module names and get the information (names, values and other
8888
attributes) of the filtered registers.
8989

90+
* **Updated Amazon ENA (Elastic Network Adapter) net driver.**
91+
92+
* Modified the PMD API that controls the LLQ header policy.
93+
* Replaced ``enable_llq``, ``normal_llq_hdr`` and ``large_llq_hdr`` devargs
94+
with a new shared devarg ``llq_policy`` that keeps the same logic.
95+
9096
* **Updated Cisco enic driver.**
9197

9298
* Added SR-IOV VF support.
@@ -124,6 +130,8 @@ API Changes
124130
Also, make sure to start the actual text at the margin.
125131
=======================================================
126132
133+
* drivers/net/ena: Removed ``enable_llq``, ``normal_llq_hdr`` and ``large_llq_hdr`` devargs
134+
and replaced it with a new shared devarg ``llq_policy`` that keeps the same logic.
127135

128136
ABI Changes
129137
-----------

drivers/net/ena/ena_ethdev.c

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,25 @@ struct ena_stats {
7979
ENA_STAT_ENTRY(stat, srd)
8080

8181
/* Device arguments */
82-
#define ENA_DEVARG_LARGE_LLQ_HDR "large_llq_hdr"
83-
#define ENA_DEVARG_NORMAL_LLQ_HDR "normal_llq_hdr"
82+
83+
/* llq_policy Controls whether to disable LLQ, use device recommended
84+
* header policy or overriding the device recommendation.
85+
* 0 - Disable LLQ. Use with extreme caution as it leads to a huge
86+
* performance degradation on AWS instances built with Nitro v4 onwards.
87+
* 1 - Accept device recommended LLQ policy (Default).
88+
* Device can recommend normal or large LLQ policy.
89+
* 2 - Enforce normal LLQ policy.
90+
* 3 - Enforce large LLQ policy.
91+
* Required for packets with header that exceed 96 bytes on
92+
* AWS instances built with Nitro v2 and Nitro v1.
93+
*/
94+
#define ENA_DEVARG_LLQ_POLICY "llq_policy"
95+
8496
/* Timeout in seconds after which a single uncompleted Tx packet should be
8597
* considered as a missing.
8698
*/
8799
#define ENA_DEVARG_MISS_TXC_TO "miss_txc_to"
88-
/*
89-
* Controls whether LLQ should be used (if available). Enabled by default.
90-
* NOTE: It's highly not recommended to disable the LLQ, as it may lead to a
91-
* huge performance degradation on 6th generation AWS instances.
92-
*/
93-
#define ENA_DEVARG_ENABLE_LLQ "enable_llq"
100+
94101
/*
95102
* Controls the period of time (in milliseconds) between two consecutive inspections of
96103
* the control queues when the driver is in poll mode and not using interrupts.
@@ -294,9 +301,9 @@ static int ena_xstats_get_by_id(struct rte_eth_dev *dev,
294301
const uint64_t *ids,
295302
uint64_t *values,
296303
unsigned int n);
297-
static int ena_process_bool_devarg(const char *key,
298-
const char *value,
299-
void *opaque);
304+
static int ena_process_llq_policy_devarg(const char *key,
305+
const char *value,
306+
void *opaque);
300307
static int ena_parse_devargs(struct ena_adapter *adapter,
301308
struct rte_devargs *devargs);
302309
static void ena_copy_customer_metrics(struct ena_adapter *adapter,
@@ -312,7 +319,6 @@ static int ena_rx_queue_intr_disable(struct rte_eth_dev *dev,
312319
static int ena_configure_aenq(struct ena_adapter *adapter);
313320
static int ena_mp_primary_handle(const struct rte_mp_msg *mp_msg,
314321
const void *peer);
315-
static ena_llq_policy ena_define_llq_hdr_policy(struct ena_adapter *adapter);
316322
static bool ena_use_large_llq_hdr(struct ena_adapter *adapter, uint8_t recommended_entry_size);
317323

318324
static const struct eth_dev_ops ena_dev_ops = {
@@ -2320,18 +2326,13 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
23202326

23212327
/* Assign default devargs values */
23222328
adapter->missing_tx_completion_to = ENA_TX_TIMEOUT;
2323-
adapter->enable_llq = true;
2324-
adapter->use_large_llq_hdr = false;
2325-
adapter->use_normal_llq_hdr = false;
23262329

23272330
/* Get user bypass */
23282331
rc = ena_parse_devargs(adapter, pci_dev->device.devargs);
23292332
if (rc != 0) {
23302333
PMD_INIT_LOG_LINE(CRIT, "Failed to parse devargs");
23312334
goto err;
23322335
}
2333-
adapter->llq_header_policy = ena_define_llq_hdr_policy(adapter);
2334-
23352336
rc = ena_com_allocate_customer_metrics_buffer(ena_dev);
23362337
if (rc != 0) {
23372338
PMD_INIT_LOG_LINE(CRIT, "Failed to allocate customer metrics buffer");
@@ -3734,44 +3735,31 @@ static int ena_process_uint_devarg(const char *key,
37343735
return 0;
37353736
}
37363737

3737-
static int ena_process_bool_devarg(const char *key,
3738-
const char *value,
3739-
void *opaque)
3738+
static int ena_process_llq_policy_devarg(const char *key, const char *value, void *opaque)
37403739
{
37413740
struct ena_adapter *adapter = opaque;
3742-
bool bool_value;
3741+
uint32_t policy;
37433742

3744-
/* Parse the value. */
3745-
if (strcmp(value, "1") == 0) {
3746-
bool_value = true;
3747-
} else if (strcmp(value, "0") == 0) {
3748-
bool_value = false;
3743+
policy = strtoul(value, NULL, DECIMAL_BASE);
3744+
if (policy < ENA_LLQ_POLICY_LAST) {
3745+
adapter->llq_header_policy = policy;
37493746
} else {
37503747
PMD_INIT_LOG_LINE(ERR,
3751-
"Invalid value: '%s' for key '%s'. Accepted: '0' or '1'",
3748+
"Invalid value: '%s' for key '%s'. valid [0-3]",
37523749
value, key);
37533750
return -EINVAL;
37543751
}
3755-
3756-
/* Now, assign it to the proper adapter field. */
3757-
if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
3758-
adapter->use_large_llq_hdr = bool_value;
3759-
else if (strcmp(key, ENA_DEVARG_NORMAL_LLQ_HDR) == 0)
3760-
adapter->use_normal_llq_hdr = bool_value;
3761-
else if (strcmp(key, ENA_DEVARG_ENABLE_LLQ) == 0)
3762-
adapter->enable_llq = bool_value;
3763-
3752+
PMD_INIT_LOG_LINE(INFO,
3753+
"LLQ policy is %u [0 - disabled, 1 - device recommended, 2 - normal, 3 - large]",
3754+
adapter->llq_header_policy);
37643755
return 0;
37653756
}
37663757

3767-
static int ena_parse_devargs(struct ena_adapter *adapter,
3768-
struct rte_devargs *devargs)
3758+
static int ena_parse_devargs(struct ena_adapter *adapter, struct rte_devargs *devargs)
37693759
{
37703760
static const char * const allowed_args[] = {
3771-
ENA_DEVARG_LARGE_LLQ_HDR,
3772-
ENA_DEVARG_NORMAL_LLQ_HDR,
3761+
ENA_DEVARG_LLQ_POLICY,
37733762
ENA_DEVARG_MISS_TXC_TO,
3774-
ENA_DEVARG_ENABLE_LLQ,
37753763
ENA_DEVARG_CONTROL_PATH_POLL_INTERVAL,
37763764
NULL,
37773765
};
@@ -3787,23 +3775,14 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
37873775
devargs->args);
37883776
return -EINVAL;
37893777
}
3790-
3791-
rc = rte_kvargs_process(kvlist, ENA_DEVARG_LARGE_LLQ_HDR,
3792-
ena_process_bool_devarg, adapter);
3793-
if (rc != 0)
3794-
goto exit;
3795-
rc = rte_kvargs_process(kvlist, ENA_DEVARG_NORMAL_LLQ_HDR,
3796-
ena_process_bool_devarg, adapter);
3778+
rc = rte_kvargs_process(kvlist, ENA_DEVARG_LLQ_POLICY,
3779+
ena_process_llq_policy_devarg, adapter);
37973780
if (rc != 0)
37983781
goto exit;
37993782
rc = rte_kvargs_process(kvlist, ENA_DEVARG_MISS_TXC_TO,
38003783
ena_process_uint_devarg, adapter);
38013784
if (rc != 0)
38023785
goto exit;
3803-
rc = rte_kvargs_process(kvlist, ENA_DEVARG_ENABLE_LLQ,
3804-
ena_process_bool_devarg, adapter);
3805-
if (rc != 0)
3806-
goto exit;
38073786
rc = rte_kvargs_process(kvlist, ENA_DEVARG_CONTROL_PATH_POLL_INTERVAL,
38083787
ena_process_uint_devarg, adapter);
38093788
if (rc != 0)
@@ -4027,9 +4006,7 @@ RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd);
40274006
RTE_PMD_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
40284007
RTE_PMD_REGISTER_KMOD_DEP(net_ena, "* igb_uio | uio_pci_generic | vfio-pci");
40294008
RTE_PMD_REGISTER_PARAM_STRING(net_ena,
4030-
ENA_DEVARG_LARGE_LLQ_HDR "=<0|1> "
4031-
ENA_DEVARG_NORMAL_LLQ_HDR "=<0|1> "
4032-
ENA_DEVARG_ENABLE_LLQ "=<0|1> "
4009+
ENA_DEVARG_LLQ_POLICY "=<0|1|2|3> "
40334010
ENA_DEVARG_MISS_TXC_TO "=<uint>"
40344011
ENA_DEVARG_CONTROL_PATH_POLL_INTERVAL "=<0-1000>");
40354012
RTE_LOG_REGISTER_SUFFIX(ena_logtype_init, init, NOTICE);
@@ -4217,17 +4194,6 @@ ena_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
42174194
return rte_mp_reply(&mp_rsp, peer);
42184195
}
42194196

4220-
static ena_llq_policy ena_define_llq_hdr_policy(struct ena_adapter *adapter)
4221-
{
4222-
if (!adapter->enable_llq)
4223-
return ENA_LLQ_POLICY_DISABLED;
4224-
if (adapter->use_large_llq_hdr)
4225-
return ENA_LLQ_POLICY_LARGE;
4226-
if (adapter->use_normal_llq_hdr)
4227-
return ENA_LLQ_POLICY_NORMAL;
4228-
return ENA_LLQ_POLICY_RECOMMENDED;
4229-
}
4230-
42314197
static bool ena_use_large_llq_hdr(struct ena_adapter *adapter, uint8_t recommended_entry_size)
42324198
{
42334199
if (adapter->llq_header_policy == ENA_LLQ_POLICY_LARGE) {

drivers/net/ena/ena_ethdev.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,6 @@ struct ena_adapter {
337337
uint32_t active_aenq_groups;
338338

339339
bool trigger_reset;
340-
bool enable_llq;
341-
bool use_large_llq_hdr;
342-
bool use_normal_llq_hdr;
343340
ena_llq_policy llq_header_policy;
344341

345342
uint32_t last_tx_comp_qid;

0 commit comments

Comments
 (0)