Skip to content

Commit

Permalink
net/hns3: fix unchecked Rx free threshold
Browse files Browse the repository at this point in the history
[ upstream commit c1f0cd3a4c834c2e550370b6d31b6bcd456a15f9 ]

To reduce the frequency of updating the head pointer of Rx queue,
driver just updates this pointer when the number of processed
descriptors is greater than the Rx free threshold. If the Rx free
threshold is set to a value greater than or equal to the number of
descriptors in Rx queue, the driver does not update this pointer.
As a result, the hardware cannot receive more packets.

This patch fix it by adding Rx free threshold check.

Fixes: bba6366 ("net/hns3: support Rx/Tx and related operations")

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
  • Loading branch information
Dengdui Huang authored and kevintraynor committed Nov 15, 2023
1 parent 79ee20d commit fc1e7c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/hns3/hns3_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,12 @@ hns3_rx_queue_conf_check(struct hns3_hw *hw, const struct rte_eth_rxconf *conf,
return -EINVAL;
}

if (conf->rx_free_thresh >= nb_desc) {
hns3_err(hw, "rx_free_thresh (%u) must be less than %u",
conf->rx_free_thresh, nb_desc);
return -EINVAL;
}

if (conf->rx_drop_en == 0)
hns3_warn(hw, "if no descriptors available, packets are always "
"dropped and rx_drop_en (1) is fixed on");
Expand Down

0 comments on commit fc1e7c7

Please sign in to comment.