net/ena/base: fix LLQ config failure flow
PATCH v2 10/13 net/ena/base: fix LLQ config failure flow
ena_com_config_dev_mode() computes tx_max_header_size directly into the ena_com_dev structure and only afterwards rejects the result if it came out zero. The error path therefore leaves the device with tx_max_header_size == 0, overwriting the value the device reported in ena_com_get_dev_attr_feat().
The failure is not fatal to the caller: the PMD logs it, falls back to host placement policy and continues, so the zeroed value stays in effect. It is then copied into the per-ring field, which sizes the Tx intermediate header buffer to zero and clamps header_len to zero on every transmit.
Compute the value into a local variable, validate it there, and store it into ena_dev only once it is known good, so a failed LLQ configuration leaves the previously negotiated value untouched.
--- drivers/net/ena/base/ena_com.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ena/base/ena_com.c +4 -2
@@ -3581,6 +3581,7 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev, struct ena_llq_configurations *llq_default_cfg) {struct ena_com_llq_info *llq_info = &ena_dev->llq_info; +u32 llq_max_header_size;int rc;if (!llq_features->max_llq_num) {
@@ -3592,14 +3593,15 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,if (unlikely (rc))return rc; - ena_dev->tx_max_header_size = llq_info->common.desc_list_entry_size - + llq_max_header_size = llq_info->common.desc_list_entry_size - (llq_info->common.descs_num_before_header *sizeof (struct ena_eth_io_tx_desc )); -if (unlikely (ena_dev->tx_max_header_size ==0 )) { +if (unlikely (llq_max_header_size ==0 )) {ena_trc_err (ena_dev,"The size of the LLQ entry is smaller than needed\n" );return ENA_COM_INVAL ; } + ena_dev->tx_max_header_size = llq_max_header_size; ena_dev->tx_mem_queue_type =ENA_ADMIN_PLACEMENT_POLICY_DEV ;return 0 ;
Signature · 1 line
2.17.1