From patchwork Wed Apr 8 06:27:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Badicioiu X-Patchwork-Id: 46863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2900A20553 for ; Wed, 8 Apr 2015 06:28:47 +0000 (UTC) Received: by wiaa2 with SMTP id a2sf7907055wia.1 for ; Tue, 07 Apr 2015 23:28:46 -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:delivered-to:from:to:date :message-id:mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=GUKMpfSFDQmJv/GMUVs6u8w/epfqM95nR7qcNrXgkcw=; b=CGkN2OsPZ9IDKEVXCIRwwuPHUftXyqtr0FcpWknSZqyqlk6X5iin+hTRy9/mm/C2D1 6TOeY7tGik+9U3As74R3wfzYgzbo2juaPv86Y8qQxv31WoShrxqdHXd4mAJzoPEGBgpM 1rc58a2FtMz9J293v5KDmT5S1veFAefjukXqA5F6fF4k0Juo0skElOPM9rzOXTGOkQkI l5MpqGqTC4uOTpbOYmvKRr28Dyp5pku6ZBc1nA01WtGWXyBkPSObAAyvYBMgUTiUwvQx hWLeohNV/EjKnRhw4J1zq780A7J82JXNRu3UUmcx3mMtLDMne/lMn5DOAU2LG7WfRa4a FdMQ== X-Gm-Message-State: ALoCoQnT85hhLu0CgG3Ogci3j3dF34bKjQJvx69g3f1GmcKvhWJ8nsthBX43bYR/Ng4NJomxglg2 X-Received: by 10.152.116.115 with SMTP id jv19mr3727814lab.9.1428474526434; Tue, 07 Apr 2015 23:28:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.110 with SMTP id bf14ls123660lab.48.gmail; Tue, 07 Apr 2015 23:28:46 -0700 (PDT) X-Received: by 10.112.92.66 with SMTP id ck2mr21529945lbb.105.1428474526148; Tue, 07 Apr 2015 23:28:46 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id re5si3219018lbb.150.2015.04.07.23.28.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2015 23:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbqq2 with SMTP id qq2so50733576lbb.3 for ; Tue, 07 Apr 2015 23:28:46 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr22104020lab.35.1428474526011; Tue, 07 Apr 2015 23:28:46 -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.112.67.65 with SMTP id l1csp861514lbt; Tue, 7 Apr 2015 23:28:45 -0700 (PDT) X-Received: by 10.55.54.6 with SMTP id d6mr3003188qka.77.1428474524905; Tue, 07 Apr 2015 23:28:44 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e90si9933111qgf.118.2015.04.07.23.28.43; Tue, 07 Apr 2015 23:28:44 -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: by lists.linaro.org (Postfix, from userid 109) id 452A264F6D; Wed, 8 Apr 2015 06:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4A02764E31; Wed, 8 Apr 2015 06:28:40 +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 2D3C164E87; Wed, 8 Apr 2015 06:28:39 +0000 (UTC) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0078.outbound.protection.outlook.com [207.46.100.78]) by lists.linaro.org (Postfix) with ESMTPS id 9E07964E31 for ; Wed, 8 Apr 2015 06:28:38 +0000 (UTC) Received: from DM2PR03CA0008.namprd03.prod.outlook.com (10.141.96.18) by BY2PR0301MB0598.namprd03.prod.outlook.com (0.160.125.20) with Microsoft SMTP Server (TLS) id 15.1.130.23; Wed, 8 Apr 2015 06:28:37 +0000 Received: from BL2FFO11OLC005.protection.gbl (2a01:111:f400:7c09::185) by DM2PR03CA0008.outlook.office365.com (2a01:111:e400:2428::18) with Microsoft SMTP Server (TLS) id 15.1.130.23 via Frontend Transport; Wed, 8 Apr 2015 06:28:37 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 192.88.158.2 as permitted sender) Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11OLC005.mail.protection.outlook.com (10.173.160.91) with Microsoft SMTP Server (TLS) id 15.1.136.16 via Frontend Transport; Wed, 8 Apr 2015 06:28:36 +0000 Received: from fsr-fed1364-15.ea.freescale.net (fsr-fed1364-15.ea.freescale.net [10.171.81.144]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t386SYi8019499; Tue, 7 Apr 2015 23:28:35 -0700 From: To: Date: Wed, 8 Apr 2015 09:27:50 +0300 Message-ID: <1428474470-30400-1-git-send-email-alexandru.badicioiu@linaro.org> X-Mailer: git-send-email 1.7.3.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130729481169079857; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(229853001)(50226001)(48376002)(50466002)(50986999)(19580395003)(105596002)(47776003)(19580405001)(110136001)(104016003)(86152002)(36756003)(62966003)(77096005)(92566002)(2351001)(77156002)(6806004)(46102003)(106466001)(33646002)(86362001)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0598; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0598; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:BY2PR0301MB0598; BCL:0; PCL:0; RULEID:(400005)(401004); SRVR:BY2PR0301MB0598; X-Forefront-PRVS: 0540846A1D X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2015 06:28:36.6739 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0598 X-Topics: patch Subject: [lng-odp] [PATCH 1/1 v1] examples: odp_ipsec: handle alloc_pkt_ctx failure X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alexandru.badicioiu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 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: Alexandru Badicioiu Application should continue in case a packet context cannot be allocated. Signed-off-by: Alexandru Badicioiu --- example/ipsec/odp_ipsec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 56e9aa8..0cbf5b4 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -187,9 +187,8 @@ pkt_ctx_t *alloc_pkt_ctx(odp_packet_t pkt) odp_buffer_t ctx_buf = odp_buffer_alloc(ctx_pool); pkt_ctx_t *ctx; - /* There should always be enough contexts */ if (odp_unlikely(ODP_BUFFER_INVALID == ctx_buf)) - abort(); + return NULL; ctx = odp_buffer_addr(ctx_buf); memset(ctx, 0, sizeof(*ctx)); @@ -1017,6 +1016,10 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) ctx = get_pkt_ctx_from_pkt(pkt); } else { ctx = alloc_pkt_ctx(pkt); + if (!ctx) { + odp_packet_free(pkt); + continue; + } ctx->state = PKT_STATE_INPUT_VERIFY; } } else if (ODP_EVENT_CRYPTO_COMPL == odp_event_type(ev)) {