From patchwork Mon Nov 24 15:41:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41409 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 B696B24524 for ; Mon, 24 Nov 2014 15:42:22 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf2181930wiw.8 for ; Mon, 24 Nov 2014 07:42:22 -0800 (PST) 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:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=BwNKAt8JwRQReH9CHPTqs7MJTTqTnQ5hVHCLbKsYA6k=; b=PbTsReLiYzFL0gWIgMKAWggZymcmypq6E2CrA7qfpuggZOdZ9oN20ot3CrN1NCBuQK ZMXMR8oH2j2hibyYNsYbCFfSd8wlbAxz7attaxPOVQnuwYdCQ4d2es7JoOBB3xNIjaFR lc2lIuv57EbXKZSsLW1kIM5C+1RvlwVWNXMKJgZcVcFq7h0E9Qv8PTAwKMbTVZZ3bibo jUl0mrXfZUzJBBVm6v4IUQASB50je08lEyCoNZOivp8ZPWoHC71vaV33aDGXbBKkAFxm GOz1eAfsTJuAyz5rQS/jaHJl/SIxOqYX+dRUffg683PuwyTrRqj/bUphk9Bv4NqfI+oW VE3w== X-Gm-Message-State: ALoCoQmRA3d9jJzwYu+B6f4mnsIBuu1WqCObsL/9b8jdt+D3ycacrpxPiZbZNNsxbRxMmAL5OJWn X-Received: by 10.112.147.131 with SMTP id tk3mr6335811lbb.2.1416843741948; Mon, 24 Nov 2014 07:42:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.228.140 with SMTP id si12ls439658lac.25.gmail; Mon, 24 Nov 2014 07:42:21 -0800 (PST) X-Received: by 10.152.22.135 with SMTP id d7mr21094921laf.46.1416843741797; Mon, 24 Nov 2014 07:42:21 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id n4si15637498lan.14.2014.11.24.07.42.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:42:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so4752561lab.26 for ; Mon, 24 Nov 2014 07:42:21 -0800 (PST) X-Received: by 10.112.38.4 with SMTP id c4mr5419081lbk.46.1416843741375; Mon, 24 Nov 2014 07:42:21 -0800 (PST) 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.184.201 with SMTP id ew9csp276510lbc; Mon, 24 Nov 2014 07:42:20 -0800 (PST) X-Received: by 10.224.160.212 with SMTP id o20mr3332726qax.57.1416843740045; Mon, 24 Nov 2014 07:42:20 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v47si16117486qge.5.2014.11.24.07.42.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:42:20 -0800 (PST) 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-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XsvmL-0005Qe-PH; Mon, 24 Nov 2014 15:42:17 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XsvmE-0005QW-TX for lng-odp@lists.linaro.org; Mon, 24 Nov 2014 15:42:11 +0000 Received: by mail-la0-f43.google.com with SMTP id q1so7772080lam.2 for ; Mon, 24 Nov 2014 07:42:05 -0800 (PST) X-Received: by 10.112.219.3 with SMTP id pk3mr21141098lbc.18.1416843725267; Mon, 24 Nov 2014 07:42:05 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id 10sm456718lao.0.2014.11.24.07.42.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:42:04 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 24 Nov 2014 17:41:59 +0200 Message-Id: <1416843719-29860-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCHv2 KS2] linux-keystone2: init: update init for McSDK 3.01.01.04 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: , MIME-Version: 1.0 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: taras.kondratiuk@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.53 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 Update initialization to be compatible with a new McSDK release. Signed-off-by: Taras Kondratiuk --- v2: Fixed NWAL_ENTRY size. platform/linux-keystone2/mcsdk/mcsdk_init.c | 85 ++++++++++++++++++--------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/platform/linux-keystone2/mcsdk/mcsdk_init.c b/platform/linux-keystone2/mcsdk/mcsdk_init.c index 5820464..24c357a 100644 --- a/platform/linux-keystone2/mcsdk/mcsdk_init.c +++ b/platform/linux-keystone2/mcsdk/mcsdk_init.c @@ -49,27 +49,24 @@ struct mcsdk_cfg_s default_mcsdk_cfg = { */ #define NWAL_CONFIG_SEC_CONTEXT_SZ 384 -#define NWAL_CONFIG_BUFSIZE_NWAL_HANDLE 3400 - -#define NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC 256 -#define NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN 256 -#define NWAL_CONFIG_BUFSIZE_NWAL_PER_IP 128 -#define NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT 128 -#define NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR 128 -#define NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT 384 +#define NWAL_CONFIG_BUFSIZE_HANDLE 3400 + +#define NWAL_CONFIG_BUFSIZE_PER_MAC 256 +#define NWAL_CONFIG_BUFSIZE_IPSEC_HANDLE_PER_CHAN 256 +#define NWAL_CONFIG_BUFSIZE_PER_IP 128 +#define NWAL_CONFIG_BUFSIZE_PER_PORT 128 +#define NWAL_CONFIG_BUFSIZE_PER_L2L3_HDR 128 +#define NWAL_CONFIG_BUFSIZE_PER_LOC_CONTEXT 384 #define NWAL_CHAN_HANDLE_SIZE \ - ((NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC * TUNE_NETAPI_MAX_NUM_MAC) + \ - (NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN * \ + ((NWAL_CONFIG_BUFSIZE_PER_MAC * TUNE_NETAPI_MAX_NUM_MAC) + \ + (NWAL_CONFIG_BUFSIZE_IPSEC_HANDLE_PER_CHAN * \ TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) + \ - (NWAL_CONFIG_BUFSIZE_NWAL_PER_IP * TUNE_NETAPI_MAX_NUM_IP) + \ - (NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT * TUNE_NETAPI_MAX_NUM_PORTS) + \ - (NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT * TUNE_NETAPI_NUM_CORES) + \ - (NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR * \ + (NWAL_CONFIG_BUFSIZE_PER_IP * TUNE_NETAPI_MAX_NUM_IP) + \ + (NWAL_CONFIG_BUFSIZE_PER_PORT * TUNE_NETAPI_MAX_NUM_PORTS) + \ + (NWAL_CONFIG_BUFSIZE_PER_LOC_CONTEXT * TUNE_NETAPI_NUM_CORES) + \ + (NWAL_CONFIG_BUFSIZE_PER_L2L3_HDR * \ TUNE_NETAPI_MAX_NUM_L2_L3_HDRS)) -uint8_t nwal_inst_mem[NWAL_CONFIG_BUFSIZE_NWAL_HANDLE] ODP_ALIGNED_CACHE; -uint8_t nwal_handle_mem[NWAL_CHAN_HANDLE_SIZE] ODP_ALIGNED_CACHE; - /** * @todo: Check if below size information can be made available * from PA interface file @@ -99,6 +96,11 @@ struct sa_global { ODP_ALIGNED_CACHE; }; +struct nwal_global { + uint8_t nwal_inst_mem[NWAL_CONFIG_BUFSIZE_HANDLE] ODP_ALIGNED_CACHE; + uint8_t nwal_handle_mem[NWAL_CHAN_HANDLE_SIZE] ODP_ALIGNED_CACHE; +}; + static uint8_t *cma_mem_alloc(uint32_t size) { return (uint8_t *)hplib_vmMemAlloc( @@ -131,9 +133,14 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) void *base = NULL; struct pa_global *pa_entry = NULL; struct sa_global *sa_entry = NULL; + struct nwal_global *nwal_entry = NULL; + nwalBaseAddrCfg_t base_addr_cfg; + uint32_t local_ctx_size = 0; + void *nwal_loc_ctx_mem = NULL; memset(&odp_global->nwal, 0, sizeof(odp_global->nwal)); memset(&nwal_global_cfg, 0, sizeof(nwal_global_cfg)); + memset(&base_addr_cfg, 0, sizeof(base_addr_cfg)); nwal_global_cfg.rmHandle = odp_proc.rm_service; @@ -143,20 +150,30 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) == hplib_OK) { pa_entry = (struct pa_global *)hplib_shmGetEntry( base, PA_ENTRY); - nwal_global_cfg.instPoolBaseAddr = (void *)pa_entry; + base_addr_cfg.pInstPoolPaBaseAddr = (void *)pa_entry; } else { odp_pr_err("Unable to Add shared memory segment for PASS\n"); return -1; } + if (hplib_shmAddEntry(base, sizeof(struct sa_global), SA_ENTRY) == hplib_OK) { sa_entry = (struct sa_global *)hplib_shmGetEntry( base, SA_ENTRY); - nwal_global_cfg.instPoolSaBaseAddr = (void *)sa_entry; + base_addr_cfg.pInstPoolSaBaseAddr = (void *)sa_entry; } else { odp_pr_err("Unable to Add shared memory segment for SASS\n"); return -1; } + + if (hplib_shmAddEntry(base, sizeof(struct nwal_global), + NWAL_ENTRY) == hplib_OK) { + nwal_entry = (struct nwal_global *)hplib_shmGetEntry( + base, NWAL_ENTRY); + } else { + odp_pr_err("Unable to Add shared memory segment for NWAL\n"); + return -1; + } } /* Initialize Buffer Pool for NetCP PA to SA packets */ nwal_global_cfg.pa2SaBufPool.numBufPools = 1; @@ -216,8 +233,8 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) nwal_global_cfg.saFwActive = nwal_FALSE; /* Pick Default Physical Address */ - nwal_global_cfg.paVirtBaseAddr = (uint32_t)odp_vm_info.passCfgVaddr; - nwal_global_cfg.saVirtBaseAddr = (uint32_t)odp_vm_info.passCfgVaddr + + base_addr_cfg.paVirtBaseAddr = odp_vm_info.passCfgVaddr; + base_addr_cfg.pSaVirtBaseAddr = (char *)odp_vm_info.passCfgVaddr + CSL_NETCP_CFG_SA_CFG_REGS - CSL_NETCP_CFG_REGS; @@ -246,8 +263,8 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) /* Check for memory size requirement and update the base */ count = 0; bases[nwal_BUF_INDEX_INST] = (uint32_t *)Osal_nwalLocToGlobAddr( - (uint32_t)nwal_inst_mem); - if (NWAL_CONFIG_BUFSIZE_NWAL_HANDLE < sizes[nwal_BUF_INDEX_INST]) { + (uint32_t)nwal_entry->nwal_inst_mem); + if (NWAL_CONFIG_BUFSIZE_HANDLE < sizes[nwal_BUF_INDEX_INST]) { /* Resize Memory */ while (1) ; @@ -255,7 +272,7 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) count++; bases[nwal_BUF_INDEX_INT_HANDLES] = (uint32_t *)Osal_nwalLocToGlobAddr( - (uint32_t)nwal_handle_mem); + (uint32_t)nwal_entry->nwal_handle_mem); if (NWAL_CHAN_HANDLE_SIZE < sizes[nwal_BUF_INDEX_INT_HANDLES]) { /* Resize Memory */ while (1) @@ -303,7 +320,7 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) bases[nwal_BUF_INDEX_SA_CONTEXT] = (uint32_t *)Osal_nwalLocToGlobAddr( (uint32_t)sa_context_mem_base); /* also save this here for easy access to sa_start */ - nwal_global_cfg.scPoolBaseAddr = bases[nwal_BUF_INDEX_SA_CONTEXT]; + base_addr_cfg.pScPoolBaseAddr = bases[nwal_BUF_INDEX_SA_CONTEXT]; count++; bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] = @@ -328,12 +345,26 @@ int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table) ; } + nwal_getLocContextBufferReq(nwal_size_info.nProc, &local_ctx_size); + nwal_loc_ctx_mem = malloc(local_ctx_size); + if (!nwal_loc_ctx_mem) { + odp_pr_err("Couldn't allocate NWAL local contex\n"); + return -1; + } + nwal_ret = nwal_createProc(bases[nwal_BUF_INDEX_INST], + nwal_loc_ctx_mem, + &base_addr_cfg); + if (nwal_ret != nwal_OK) { + odp_pr_err("nwal_createProc: Failed %d\n", nwal_ret); + return -1; + } + + nwal_global_cfg.pBaseAddrCfg = &base_addr_cfg; /* Initialize NWAL module */ nwal_ret = nwal_create(&nwal_global_cfg, &nwal_size_info, sizes, bases, &odp_global->nwal.handle); if (nwal_ret != nwal_OK) { - odp_pr_err("nwal_create Failed %d\n", - nwal_ret); + odp_pr_err("nwal_create Failed %d\n", nwal_ret); return -1; }