summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Agrawal <hemant.agrawal@nxp.com>2019-07-25 16:36:45 +0530
committerKevin Traynor <ktraynor@redhat.com>2019-09-13 10:37:20 +0100
commit3d2802e7739aacce502e5be043ee3b0f306878be (patch)
tree5c3fc79848f3f6d30fe9602abfbaf0fc3d9eecea
parentaae9f84f882732fafc37af9fc24b10b8a1d92251 (diff)
downloaddpdk-stable-3d2802e7739aacce502e5be043ee3b0f306878be.zip
dpdk-stable-3d2802e7739aacce502e5be043ee3b0f306878be.tar.gz
dpdk-stable-3d2802e7739aacce502e5be043ee3b0f306878be.tar.xz
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: dec08c28c0b3 ("virtio: check packet headroom at compile time") Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
-rw-r--r--drivers/net/virtio/virtio_ethdev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 9098cb6..8c54edc 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/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;