From patchwork Sun Aug 24 10:53:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 35880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D05020565 for ; Sun, 24 Aug 2014 10:54:19 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf37936360qge.8 for ; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=UNud0L3MVdWE4ny79azZkh76CEQtwkhS7jF5bEoXmuA=; b=aiCGXpHKSmXyZL1bzic9Etb8wAsLfwrgjpy1xOaDXg67huduStf9mZPMA5f4b2G9Zr LtxpBflFmvyjewMonEq/6XDay6RO0r+wTLfFGLHz754M4MqgHoG77oMM0vFxO5c8uiaS 4PdKbnejJ4lBh99LtA0VYSB7LhxUv5cXlcF+BZ0BBGOYru9KWo0JEbFzTqf8TITCcrZQ bxzkK5dIog73JqIq7Ovu7XWfiy4FVJel2dpglOXQ2QjYJmZVn3as/ESQ5cAU0+y0MAOs xpwv3yTsTXgN48uRXQ8/n+FVilg8e6tFHE+7yBnOAyXVnDZO5/VT3vfokM1nPVkyO7/7 kOlQ== X-Gm-Message-State: ALoCoQmqBGOmei5b3jtBxdyt2t1oHItaEr8an2N1sPSrNTNpv6Gyx3DkshYvLHs1GZq5J1oyhN8p X-Received: by 10.52.174.178 with SMTP id bt18mr10448805vdc.1.1408877658903; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.242 with SMTP id s105ls1754170qge.42.gmail; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-Received: by 10.53.5.163 with SMTP id cn3mr7202701vdd.3.1408877658820; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id x5si14950743vcy.51.2014.08.24.03.54.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Aug 2014 03:54:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so14343834vcb.0 for ; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-Received: by 10.220.168.210 with SMTP id v18mr12409386vcy.3.1408877658749; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp42900vcb; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) X-Received: by 10.140.42.195 with SMTP id c61mr13658867qga.54.1408877658266; Sun, 24 Aug 2014 03:54:18 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id t67si48440792qga.49.2014.08.24.03.54.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 24 Aug 2014 03:54:18 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XLVRB-0003Nv-DO; Sun, 24 Aug 2014 10:54:17 +0000 Received: from ezexch.ezchip.com ([212.179.42.101] helo=ezchip.com) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XLVR4-0003NV-0C for lng-odp@lists.linaro.org; Sun, 24 Aug 2014 10:54:10 +0000 Received: from Internal Mail-Server by ezexch (envelope-from giladb@ezchip.com) with AES128-SHA encrypted SMTP; 24 Aug 2014 13:53:22 +0300 Received: from nps06.ezchip.com (10.1.3.132) by ezex10.ezchip.com (10.1.1.4) with Microsoft SMTP Server id 14.3.174.1; Sun, 24 Aug 2014 13:53:58 +0300 From: Gilad Ben-Yossef To: Date: Sun, 24 Aug 2014 13:53:57 +0300 Message-ID: <1408877638-18082-2-git-send-email-giladb@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1408877638-18082-1-git-send-email-giladb@ezchip.com> References: <1408877638-18082-1-git-send-email-giladb@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-7.500.1018-20902.006 X-TM-AS-Result: No--5.532800-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-Topics: patch Cc: Gilad Ben-Yossef Subject: [lng-odp] [PATCH 1/2] odp_packet_socket: define PACKET_FANOUT if needed X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: giladb@ezchip.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Gilad Ben-Yossef PACKET_FANOUT and friends is only defined post kernel 3.1, meaning a build against older kernel header fails. By providing a backwards compatible define for older kernels we allow the build to work, if run time attempts of using the missing functionality on older kernels to degrade to a run-time EINVAL error in init time if the specific feature is used. Signed-off-by: Gilad Ben-Yossef --- platform/linux-generic/include/odp_packet_socket.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index f991806..f38f5b0 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -29,6 +29,16 @@ /** Max transmit (Tx) burst size*/ #define ODP_PACKET_SOCKET_MAX_BURST_TX 32 +/* + * This makes sure that building for kernels older than 3.1 works + * and a fanout requests fails (for invalid packet socket option) + * in runtime if requested + */ +#ifndef PACKET_FANOUT +#define PACKET_FANOUT 18 +#define PACKET_FANOUT_HASH 0 +#endif /* PACKET_FANOUT */ + typedef struct { int sockfd; /**< socket descriptor */ odp_buffer_pool_t pool; /**< buffer pool to alloc packets from */