[dpdk-stable] [PATCH BUG 335 3/3] net/virtio: fix compilation error with 0 headroom
Hemant Agrawal
hemant.agrawal at nxp.com
Thu Jul 25 13:06:45 CEST 2019
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.
Reported as: https://bugs.dpdk.org/show_bug.cgi?id=335
Fixes: 198ab33677c9 ("net/virtio: move device initialization in a function")
Cc: stable at dpdk.org
Cc: Olivier Matz <olivier.matz at 6wind.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
drivers/net/virtio/virtio_ethdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 62c827443..3e2e8bd2a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1848,7 +1848,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;
--
2.17.1
More information about the stable
mailing list