diff mbox

[dpdk-dev,RFC,11/17] virtio: Check for packet headroom at compile time

Message ID 1418019716-4962-12-git-send-email-changchun.ouyang@intel.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Ouyang Changchun Dec. 8, 2014, 6:21 a.m. UTC
Better to check at compile time than fail at runtime.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_pmd_virtio/virtio_ethdev.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff mbox

Patch

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index a07f4ca..c17cac8 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -882,11 +882,7 @@  eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,
 	uint32_t offset_conf = sizeof(config->mac);
 	struct rte_pci_device *pci_dev;
 
-	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;