virtio: check packet headroom at compile time
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 9 Feb 2015 01:14:00 +0000 (09:14 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 20 Feb 2015 18:18:22 +0000 (19:18 +0100)
Better to check at compile time than fail at runtime.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
lib/librte_pmd_virtio/virtio_ethdev.c

index 662a49c..427341b 100644 (file)
@@ -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;