From patchwork Wed Apr 1 09:36:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Badicioiu X-Patchwork-Id: 47078 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D2C421416 for ; Sat, 11 Apr 2015 09:52:33 +0000 (UTC) Received: by lamp14 with SMTP id p14sf9091092lam.3 for ; Sat, 11 Apr 2015 02:52:31 -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=SAr/52ICymHTV1YwgfTPKD7VPXkkwZTNcrpr2hEqjWNlFIx5bwLLY5ukWvNkTwSxa6 UloYEwo8ls66JrQ705HyhmRx/TyxT0TGB9ALw3l7NDaLlzL6hf5s9Yf1IW6W9eHrBzF2 Up9XuXRDAuaXml6jN2vmCTDXqYHCVDF8m6toMMA8bH1hycJbE5Zr01sbZ/KrQNTXzG/k dXnViFF0lyaMhlqORVTtEXcv6X+I5gNIJtDwNULGCweZrttLO+mPlz9OAKyN7uaAWme9 9Ivqximp7tkBwFhmEU4DZFuTlaMIAhggsKFXdvwxyot8Iu1XT46RGPUnpcpI3Guy+Ik/ 1BOA== X-Gm-Message-State: ALoCoQkwBSclSS5nhfeAS+ufm6gM9doSHOZNacrWSU2+Yk70Vj3ILkyk40se76rCH0EpPzz6EyQ3 X-Received: by 10.112.189.131 with SMTP id gi3mr893039lbc.6.1428745951691; Sat, 11 Apr 2015 02:52:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.3 with SMTP id bc3ls256599lab.22.gmail; Sat, 11 Apr 2015 02:52:31 -0700 (PDT) X-Received: by 10.152.43.43 with SMTP id t11mr4814977lal.74.1428745951544; Sat, 11 Apr 2015 02:52:31 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id jc6si3481973lac.90.2015.04.11.02.52.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Apr 2015 02:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by layy10 with SMTP id y10so28310609lay.0 for ; Sat, 11 Apr 2015 02:52:31 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr5082553lab.35.1428745951364; Sat, 11 Apr 2015 02:52:31 -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 l1csp230386lbt; Sat, 11 Apr 2015 02:52:30 -0700 (PDT) X-Received: by 10.140.239.140 with SMTP id k134mr6807294qhc.98.1428745950145; Sat, 11 Apr 2015 02:52:30 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f199si4377067qhc.20.2015.04.11.02.52.29; Sat, 11 Apr 2015 02:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 6979463558; Sat, 11 Apr 2015 09:52:29 +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=ham 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 D57476512A; Sat, 11 Apr 2015 09:52:18 +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 05C5864F30; Wed, 1 Apr 2015 09:37:09 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0077.outbound.protection.outlook.com [65.55.169.77]) by lists.linaro.org (Postfix) with ESMTPS id 77EDC64E37 for ; Wed, 1 Apr 2015 09:37:08 +0000 (UTC) Received: from CO2PR03CA0034.namprd03.prod.outlook.com (10.141.194.161) by BY1PR0301MB1192.namprd03.prod.outlook.com (25.160.195.150) with Microsoft SMTP Server (TLS) id 15.1.118.21; Wed, 1 Apr 2015 09:37:07 +0000 Received: from BN1BFFO11FD050.protection.gbl (2a01:111:f400:7c10::1:100) by CO2PR03CA0034.outlook.office365.com (2a01:111:e400:1414::33) with Microsoft SMTP Server (TLS) id 15.1.118.21 via Frontend Transport; Wed, 1 Apr 2015 09:37:07 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD050.mail.protection.outlook.com (10.58.145.5) with Microsoft SMTP Server (TLS) id 15.1.136.16 via Frontend Transport; Wed, 1 Apr 2015 09:37:06 +0000 Received: from fsr-fed1364-15.ea.freescale.net (fsr-fed1364-15.ea.freescale.net [10.171.81.144]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t319b4MJ013932; Wed, 1 Apr 2015 02:37:05 -0700 From: To: Date: Wed, 1 Apr 2015 12:36:45 +0300 Message-ID: <1427881005-1484-1-git-send-email-alexandru.badicioiu@linaro.org> X-Mailer: git-send-email 1.7.3.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130723546266988290; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(104016003)(2351001)(50226001)(106466001)(229853001)(105596002)(77096005)(47776003)(62966003)(50466002)(86152002)(77156002)(6806004)(48376002)(86362001)(110136001)(87936001)(19580395003)(19580405001)(50986999)(33646002)(46102003)(92566002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB1192; H:tx30smr01.am.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:BY1PR0301MB1192; 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:BY1PR0301MB1192; BCL:0; PCL:0; RULEID:(401004)(400005); SRVR:BY1PR0301MB1192; X-Forefront-PRVS: 053315510E X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2015 09:37:06.5272 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1192 X-Topics: patch Subject: [lng-odp] [PATCH 1/1] 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.215.48 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)) {