From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id B0EF168B9 for ; Fri, 22 Nov 2013 11:24:10 +0100 (CET) Received: by mail-wg0-f47.google.com with SMTP id y10so902158wgg.26 for ; Fri, 22 Nov 2013 02:25:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4bhG8JtQQ6xUCS8bmqmq5+GryVjqcGHqHPYOtrsHlkY=; b=JAOMuKPtczs8A6m39dNoIhG6eg74m4ziNUZNA3knWwu6s+uLxRga8yt1K/5t5CsaA+ ndL7j2ovWkstVl3Oq+XZLYe3OnvmY6+i9L8e1zZTTZsG7WUPvpBs2a31qvNBv2mHbjz2 ka0xxCmM8lBVt1zqsvijBg/Zgg0cOsND0b2MbnDSeO7ZNYTjsOI1C3I/+AcPMA/TLMv0 SKIzENyO7DnG9eJK1bwU7kxr3Wq/pYtR3fQAQkZ2uatPFXK8Ovk7vfDdwC50KEwAR/Eh vDeF4gdnWa9MANOxmPI7fHHdk1vUrU9CD2FZ2fm27NVGm3NgW7XbMnaN2d3a65M4oh30 A8lA== X-Gm-Message-State: ALoCoQnHy7QR+kEKqI4eN09z4V5jnoslR8EaqMZcGQhrd98BTpiPm7p3O3gkJGAd2iUj5rydFrLP X-Received: by 10.180.189.68 with SMTP id gg4mr2005678wic.46.1385115909337; Fri, 22 Nov 2013 02:25:09 -0800 (PST) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id c10sm14319377wie.11.2013.11.22.02.25.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2013 02:25:08 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Fri, 22 Nov 2013 11:24:57 +0100 Message-Id: <408d807d1aac86ea0b7e2cb2907faff56aa6e7a8.1385115073.git.david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 3/3] pcap: fix build when pcap_sendpacket is unavailable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2013 10:24:11 -0000 Before libpcap 1.0.0, pcap_sendpacket was not available on linux targets (unless backported). When using such a library, we won't be able to send packet on the wire, yet we can still dump packets into a pcap file. Signed-off-by: David Marchand --- lib/librte_pmd_pcap/rte_eth_pcap.c | 12 ++++++++++++ lib/librte_pmd_pcap/rte_eth_pcap.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c index 50de885..19d19b3 100644 --- a/lib/librte_pmd_pcap/rte_eth_pcap.c +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c @@ -199,6 +199,7 @@ eth_pcap_tx_dumper(void *queue, return num_tx; } +#ifdef PCAP_CAN_SEND /* * Callback to handle sending packets through a real NIC. */ @@ -229,6 +230,17 @@ eth_pcap_tx(void *queue, tx_queue->err_pkts += nb_pkts - num_tx; return num_tx; } +#else +static uint16_t +eth_pcap_tx(__rte_unused void *queue, + __rte_unused struct rte_mbuf **bufs, + __rte_unused uint16_t nb_pkts) +{ + RTE_LOG(ERR, PMD, "pcap library cannot send packets, please rebuild " + "with a more up to date libpcap\n"); + return -1; +} +#endif static int eth_dev_start(struct rte_eth_dev *dev) diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.h b/lib/librte_pmd_pcap/rte_eth_pcap.h index a1bd513..368ed88 100644 --- a/lib/librte_pmd_pcap/rte_eth_pcap.h +++ b/lib/librte_pmd_pcap/rte_eth_pcap.h @@ -39,6 +39,12 @@ extern "C" { #endif #include +#ifdef pcap_sendpacket +#define PCAP_CAN_SEND +#else +#undef PCAP_CAN_SEND +#endif + #define RTE_ETH_PCAP_PARAM_NAME "eth_pcap" int rte_eth_from_pcaps(pcap_t * const rx_queues[], -- 1.7.10.4