Skip to content
Permalink
Browse files

net/virtio: fix build with 0 headroom

[ upstream commit c1ada9b63b8309a99c6370ff50a24b7d6d238c9b ]

When using RTE_PKTMBUF_HEADROOM as 0, virito ethdev driver throws
compilation error
virtio_ethdev.c:1851:2: note: in expansion of macro ‘RTE_BUILD_BUG_ON’
RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM
	< sizeof(struct virtio_net_hdr_mrg_rxbuf));

This patch change it into run-time check.

Bugzilla ID: 335
Fixes: dec08c2 ("virtio: check packet headroom at compile time")

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information...
hemantagr authored and kevintraynor committed Jul 25, 2019
1 parent c52e584 commit 3a8c48fa93658afad461a86136f6c61c1a2b8024
Showing with 8 additions and 1 deletion.
  1. +8 −1 drivers/net/virtio/virtio_ethdev.c
@@ -1665,7 +1665,14 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
struct virtio_hw *hw = eth_dev->data->dev_private;
int ret;

RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr_mrg_rxbuf));
if (sizeof(struct virtio_net_hdr_mrg_rxbuf) > RTE_PKTMBUF_HEADROOM) {
PMD_INIT_LOG(ERR,
"Not sufficient headroom required = %d, avail = %d",
(int)sizeof(struct virtio_net_hdr_mrg_rxbuf),
RTE_PKTMBUF_HEADROOM);

return -1;
}

eth_dev->dev_ops = &virtio_eth_dev_ops;

0 comments on commit 3a8c48f

Please sign in to comment.
You can’t perform that action at this time.