From patchwork Mon Nov 24 15:32:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41408 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AEB8C24524 for ; Mon, 24 Nov 2014 15:32:48 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf5823033eek.3 for ; Mon, 24 Nov 2014 07:32:47 -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=y1VtT+tOsbEhnWsYRtlTst+dIbpD/Ts5V+jmwYNir8A=; b=Ld4jvuCl+2cV43zt3kCUFNA1suuRb6/ByLwvCtGb+WDoo6dgyRUR4i3k3TMBALxqPU /wX1PK9dxMy+QLoB1Yedl3Qa4oHLjHTBqUN01vzCr6nO0hFsFKpQfkOl2LwLfo7xynsW th/XQpRoLV1NL+tN/bdO7HH8uF3U3zXuLx+Eja7qHN+5Uf/mMZ9eK0PFfIf1gX3Y5DjB bUaTYTjwwQzFF+34413ZQRGdzhOAPI9leVskBoTFV/xGmT+pmGrQMdIs8WETUvHoQFeX P+//Yc1Lr5TxhDOIPo2OvjEq5Gdi/4eg266nzyjqdt0UeogET2yqEK29A5u4vDijqkRA Oszw== X-Gm-Message-State: ALoCoQmTI3PDWGP1rn+1WGLs42OQSOtwbtbaDnIKk+1aUJJqk/WoSJoNcpDNFlX4FeJ5Xsi7gU03 X-Received: by 10.194.178.163 with SMTP id cz3mr6369214wjc.1.1416843167942; Mon, 24 Nov 2014 07:32:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.200 with SMTP id h8ls23565lae.76.gmail; Mon, 24 Nov 2014 07:32:47 -0800 (PST) X-Received: by 10.112.159.229 with SMTP id xf5mr20916872lbb.64.1416843167524; Mon, 24 Nov 2014 07:32:47 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ev4si15493170lbc.105.2014.11.24.07.32.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:32:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so6604634lbv.0 for ; Mon, 24 Nov 2014 07:32:47 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr20630730lbr.74.1416843167391; Mon, 24 Nov 2014 07:32:47 -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 ew9csp274549lbc; Mon, 24 Nov 2014 07:32:46 -0800 (PST) X-Received: by 10.236.28.167 with SMTP id g27mr18405027yha.42.1416843165855; Mon, 24 Nov 2014 07:32:45 -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 l4si15993824qct.45.2014.11.24.07.32.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:32:45 -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 1Xsvd5-0005AO-I2; Mon, 24 Nov 2014 15:32:43 +0000 Received: from mail-la0-f47.google.com ([209.85.215.47]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xsvcq-00059o-9x for lng-odp@lists.linaro.org; Mon, 24 Nov 2014 15:32:28 +0000 Received: by mail-la0-f47.google.com with SMTP id hz20so7848919lab.34 for ; Mon, 24 Nov 2014 07:32:22 -0800 (PST) X-Received: by 10.112.234.201 with SMTP id ug9mr21437774lbc.14.1416843142352; Mon, 24 Nov 2014 07:32:22 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id f7sm3617196lam.26.2014.11.24.07.32.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:32:21 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 24 Nov 2014 17:32:15 +0200 Message-Id: <1416843135-29422-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH 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.217.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 Update initialization to be compatible with a new McSDK release. Signed-off-by: Taras Kondratiuk --- 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..44eb0ae 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 sa_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; }