From patchwork Thu Oct 19 12:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116390 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp421916qgn; Thu, 19 Oct 2017 05:14:02 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RRVJJHEhSBYORzlvYlBgjHjdnuqfrCqGO6Xt3Sk9mBFkY5AZrpU+S3swKqAJhhpBfNVYj6 X-Received: by 10.55.1.8 with SMTP id 8mr54033qkb.80.1508415242342; Thu, 19 Oct 2017 05:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508415242; cv=none; d=google.com; s=arc-20160816; b=V1+s8G24XUEtnPgS2Qj070dI4QifPHET1fQmznhomnJ0jDOLM7t9ynQsNhkmFKatIF yPdsl1cSce5ez3rfMIslZLFfxKGfKFCUlVmvPiGNofd07gONCf5jkfKnZsMaY7ZfVf+L 3Iq8xl/Vkmjo4Ku6kMD8LRfcXRhfsQ2pKkTmEAm33kijQI6jCBdnm27rg6TGUAbk/URy ZGZQo8NSTTxN5y4cNWHuUttDPrxS0IPy2U6hbd6CuWEAQ133TPwfWckQDWcvo7NxLAKg Rbe9wnPBAo51HSg85ifBcfw5m7m2oq0pz8mcqh/6sBO+uA0I75kY/unUwWTYZcD0Rn76 1+lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=lxfUIwc/flhNOTQJ8+toB5/iYZ59MELW++eoS0kZ06o=; b=y2Vn+F3FZWbcLR2wPBKqS6OhHQRHgj/3ydwLg7L9X57yMcL7f99OBxSYqTvbV6sE0k cy+A0o6MWk4F2f5PAQPIgPhVa3lTT9BSVFrD7gAdG5bDB1eDKFnf8WfVtUaqDm+8KyZd UsMVwlr2aE81kcYtwSA6AXo2jQbF0bXmP6qGUiFdd5O5B3vQzcF05Y4cpg1Ha6gt+Sdp 5nYfLeCuN/e6+Y2GVbUfDOWptHA8XXZmkyAUm1FSd+xtovIfVf2U4pMilXa0e3Q+K6fb CVJ1ZT9gamdIhp+OfebZZJZpm8R6ZNNXvqQ9xCjZ7eb9uIZP2Nx9HHAeY3gfZAIHMYUS Asgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o39si2542918qta.471.2017.10.19.05.14.02; Thu, 19 Oct 2017 05:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 0892862F45; Thu, 19 Oct 2017 12:14:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3D3FB62AEA; Thu, 19 Oct 2017 12:04:24 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C4B6262ADC; Thu, 19 Oct 2017 12:03:58 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id DBA8462AC2 for ; Thu, 19 Oct 2017 12:00:28 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 601C434C2EE8 for ; Thu, 19 Oct 2017 15:00:26 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Stj1y1q1wm-0QnSnbVt; Thu, 19 Oct 2017 15:00:26 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lZE2bfHgVf-0PIePA4D; Thu, 19 Oct 2017 15:00:25 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 19 Oct 2017 15:00:07 +0300 Message-Id: <1508414408-10456-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508414408-10456-1-git-send-email-odpbot@yandex.ru> References: <1508414408-10456-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 241 Subject: [lng-odp] [PATCH v1 8/9] linux-gen: pktio: pcap: use generic pktio_ops data storage X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 241 (bogdanPricope:2_0_pktio_ops_pr) ** https://github.com/Linaro/odp/pull/241 ** Patch: https://github.com/Linaro/odp/pull/241.patch ** Base sha: 76f82972ecb51aa64215c97cb3d7f94e5de980f9 ** Merge commit sha: 24c411a2875cbcd686833666d481a0197cc82e90 **/ .../linux-generic/include/odp_pktio_ops_subsystem.h | 4 ---- platform/linux-generic/pktio/pcap.c | 19 +++++++++---------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/platform/linux-generic/include/odp_pktio_ops_subsystem.h b/platform/linux-generic/include/odp_pktio_ops_subsystem.h index edc5ab8a6..64940d514 100644 --- a/platform/linux-generic/include/odp_pktio_ops_subsystem.h +++ b/platform/linux-generic/include/odp_pktio_ops_subsystem.h @@ -80,15 +80,11 @@ typedef ODP_MODULE_CLASS(pktio_ops) { odp_api_proto(pktio_ops, print) print; } pktio_ops_module_t; -/* All implementations of this subsystem */ -#include - /* Per implementation private data * TODO: refactory each implementation to hide it internally */ typedef union { void *dpdk; - pktio_ops_pcap_data_t pcap; } pktio_ops_data_t; /* Extract pktio ops data from pktio entry structure */ diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 252a9048f..5bfaeef0e 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -139,8 +140,7 @@ static int _pcapif_init_tx(pktio_ops_pcap_data_t *pcap) static int pcapif_init(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, const char *devname, odp_pool_t pool) { - pktio_ops_pcap_data_t *pcap = - &pktio_entry->ops_data(pcap); + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); int ret; memset(pcap, 0, sizeof(pktio_ops_pcap_data_t)); @@ -167,7 +167,7 @@ static int pcapif_init(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, static int pcapif_close(pktio_entry_t *pktio_entry) { - pktio_ops_pcap_data_t *pcap = &pktio_entry->ops_data(pcap); + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); if (pcap->tx_dump) pcap_dump_close(pcap->tx_dump); @@ -214,8 +214,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, odp_packet_t pkt; odp_packet_hdr_t *pkt_hdr; uint32_t pkt_len; - pktio_ops_pcap_data_t *pcap = - &pktio_entry->ops_data(pcap); + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); odp_time_t ts_val; odp_time_t *ts = NULL; @@ -298,8 +297,7 @@ static int _pcapif_dump_pkt(pktio_ops_pcap_data_t *pcap, odp_packet_t pkt) static int pcapif_send_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, const odp_packet_t pkts[], int len) { - pktio_ops_pcap_data_t *pcap = - &pktio_entry->ops_data(pcap); + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); int i; odp_ticketlock_lock(&pktio_entry->s.txl); @@ -367,8 +365,7 @@ static int pcapif_promisc_mode_set(pktio_entry_t *pktio_entry, { char filter_exp[64] = {0}; struct bpf_program bpf; - pktio_ops_pcap_data_t *pcap = - &pktio_entry->ops_data(pcap); + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); if (!pcap->rx) { pcap->promisc = enable; @@ -408,7 +405,9 @@ static int pcapif_promisc_mode_set(pktio_entry_t *pktio_entry, static int pcapif_promisc_mode_get(pktio_entry_t *pktio_entry) { - return pktio_entry->ops_data(pcap).promisc; + pktio_ops_pcap_data_t *pcap = odp_ops_data(pktio_entry, pcap); + + return pcap->promisc; } static int pcapif_stats_reset(pktio_entry_t *pktio_entry)