From dec08c28c0b30a6167df6895084fa1f7c6aa2505 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 9 Feb 2015 09:14:00 +0800 Subject: [PATCH] virtio: check packet headroom at compile time Better to check at compile time than fail at runtime. Signed-off-by: Stephen Hemminger Signed-off-by: Changchun Ouyang Acked-by: Huawei Xie --- lib/librte_pmd_virtio/virtio_ethdev.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index 662a49ca89..427341b2dd 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -859,11 +859,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, struct virtio_hw *hw = VIRTIO_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - if (RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr)) { - PMD_INIT_LOG(ERR, - "MBUF HEADROOM should be enough to hold virtio net hdr\n"); - return -1; - } + RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr)); eth_dev->dev_ops = &virtio_eth_dev_ops; eth_dev->tx_pkt_burst = &virtio_xmit_pkts; -- 2.20.1