From patchwork Sat Jun 3 15:09:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 770798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wg4K26w0Bz9s65 for ; Sun, 4 Jun 2017 01:10:46 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2E89B5A7; Sat, 3 Jun 2017 15:10:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0FEDF483 for ; Sat, 3 Jun 2017 15:10:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A55C313B for ; Sat, 3 Jun 2017 15:10:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FD1C80469; Sat, 3 Jun 2017 15:10:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0FD1C80469 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=aconole@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0FD1C80469 Received: from dhcp-25-97.bos.redhat.com (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01D637D679; Sat, 3 Jun 2017 15:10:07 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Sat, 3 Jun 2017 11:09:56 -0400 Message-Id: <20170603151001.19716-2-aconole@redhat.com> In-Reply-To: <20170603151001.19716-1-aconole@redhat.com> References: <20170603151001.19716-1-aconole@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 03 Jun 2017 15:10:09 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner , Ansis Atteka Subject: [ovs-dev] [PATCH 1/6] soexpand: enable dpdk specific blocks X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Normally, in C code, pre-processing macros can be used to enable/disable specific functionality based on switches passed to configure. This works for DPDK using the --with-dpdk flag, which sets the DPDK_NETDEV define to the appropriate value. However, not all files are processed with the C pre-processor. For those files which are not, the soexpand utility grows a new feature to simply filter out those stanzas which aren't dpdk relevant. Signed-off-by: Aaron Conole --- Makefile.am | 6 +++++- build-aux/soexpand.pl | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index d810a5e..b596266 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,9 @@ AM_CFLAGS += $(OVS_CFLAGS) if DPDK_NETDEV AM_CFLAGS += -D_FILE_OFFSET_BITS=64 +SOEXPAND_DPDK_BLOCKS ="--dpdk" +else +SOEXPAND_DPDK_BLOCKS ="--nodpdk" endif if NDEBUG @@ -136,7 +139,8 @@ ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer- SUFFIXES += .in .in: - $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \ + $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) \ + $(SOEXPAND_DPDK_BLOCKS) < $< | \ sed \ -e 's,[@]PKIDIR[@],$(PKIDIR),g' \ -e 's,[@]LOGDIR[@],$(LOGDIR),g' \ diff --git a/build-aux/soexpand.pl b/build-aux/soexpand.pl index 2162564..4e91c7d 100644 --- a/build-aux/soexpand.pl +++ b/build-aux/soexpand.pl @@ -18,15 +18,25 @@ use Getopt::Long; my ($exit_code) = 0; my (@include_dirs); +my ($check_dpdk) = 0; +my ($disabled_output) = 0; + Getopt::Long::Configure ("bundling"); -GetOptions("I|include=s" => \@include_dirs) or exit(1); +GetOptions("I|include=s" => \@include_dirs, + 'dpdk!' => \$check_dpdk) or exit(1); @include_dirs = ('.') if !@include_dirs; OUTER: while () { if (my ($name) = /^\.so (\S+)$/) { foreach my $dir (@include_dirs, '.') { if (open(INNER, "$dir/$name")) { while () { - print $_; + if (/@(begin|end)_dpdk@/) { + if (!$check_dpdk) { + $disabled_output = ! $disabled_output; + } + next; + } + print $_ unless $disabled_output; } close(INNER); next OUTER; @@ -35,6 +45,13 @@ OUTER: while () { print STDERR "$name not found in: ", join(' ', @include_dirs), "\n"; $exit_code = 1; } - print $_; + if (/@(begin|end)_dpdk@/) { + if (!$check_dpdk) { + $disabled_output = ! $disabled_output; + } + next; + } + + print $_ unless $disabled_output; } exit $exit_code;