[dpdk-dev] [PATCH v2] net/virtio: add Tx preparation
Tiwei Bie
tiwei.bie at intel.com
Wed Jun 5 03:41:17 CEST 2019
Hi,
Thanks for the patch!
On Mon, Jun 03, 2019 at 07:50:05PM +0100, Andrew Rybchenko wrote:
[...]
> uint16_t
> +virtio_xmit_pkts_prepare(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts,
> + uint16_t nb_pkts)
> +{
> + uint16_t nb_tx;
> + int error;
> +
> + for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
> + struct rte_mbuf *m = tx_pkts[nb_tx];
> +
> +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> + error = rte_validate_tx_offload(m);
> + if (unlikely(error)) {
> + rte_errno = -error;
> + break;
> + }
> +#endif
> +
> + error = rte_net_intel_cksum_prepare(m);
> + if (unlikely(error)) {
> + rte_errno = -error;
It's a bit confusing here.
Based on the API doc of rte_eth_tx_prepare():
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/lib/librte_ethdev/rte_ethdev.h#L4360-L4362
It should set negative value to rte_errno when error happens,
and that's also what some other PMDs do, e.g.:
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/drivers/net/iavf/iavf_rxtx.c#L1701
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/drivers/net/iavf/iavf_rxtx.c#L1725
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/drivers/net/vmxnet3/vmxnet3_rxtx.c#L364
But some PMDs and rte_eth_tx_prepare() itself don't do this:
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/lib/librte_ethdev/rte_ethdev.h#L4377
https://github.com/DPDK/dpdk/blob/7f9f46d6cef5b03681a3935b9a18378e08ca6f62/lib/librte_ethdev/rte_ethdev.h#L4387
> + break;
> + }
> +
> + if (m->ol_flags & PKT_TX_TCP_SEG)
> + virtio_tso_fix_cksum(m);
> + }
> +
> + return nb_tx;
> +}
> +
> +uint16_t
> virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t nb_pkts)
> {
> --
> 1.8.3.1
>
More information about the dev
mailing list