Skip to content

Commit

Permalink
net/iavf: fix Tx preparation
Browse files Browse the repository at this point in the history
[ upstream commit 0f536bae86b30e82ba95c279f1d6f9095d7f5b6e ]

1. check nb_segs > Tx ring size for TSO case.
2. report nb_mtu_seg_max and nb_seg_max in dev_info.

Fixes: a2b29a7 ("net/avf: enable basic Rx Tx")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
  • Loading branch information
qzhan16 authored and bluca committed Nov 8, 2023
1 parent 01ae596 commit f2d7828
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions drivers/net/iavf/iavf_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,8 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
.nb_max = IAVF_MAX_RING_DESC,
.nb_min = IAVF_MIN_RING_DESC,
.nb_align = IAVF_ALIGN_RING_DESC,
.nb_mtu_seg_max = IAVF_TX_MAX_MTU_SEG,
.nb_seg_max = IAVF_MAX_RING_DESC,
};

return 0;
Expand Down
7 changes: 4 additions & 3 deletions drivers/net/iavf/iavf_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2347,12 +2347,12 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)

/* TX prep functions */
uint16_t
iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
iavf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
int i, ret;
uint64_t ol_flags;
struct rte_mbuf *m;
struct iavf_tx_queue *txq = tx_queue;

for (i = 0; i < nb_pkts; i++) {
m = tx_pkts[i];
Expand All @@ -2365,7 +2365,8 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
return i;
}
} else if ((m->tso_segsz < IAVF_MIN_TSO_MSS) ||
(m->tso_segsz > IAVF_MAX_TSO_MSS)) {
(m->tso_segsz > IAVF_MAX_TSO_MSS) ||
(m->nb_segs > txq->nb_tx_desc)) {
/* MSS outside the range are considered malicious */
rte_errno = EINVAL;
return i;
Expand Down

0 comments on commit f2d7828

Please sign in to comment.