From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 673371B224 for ; Fri, 6 Oct 2017 20:21:02 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Oct 2017 11:21:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,484,1500966000"; d="scan'208";a="907513668" Received: from unknown (HELO [10.241.225.2]) ([10.241.225.2]) by FMSMGA003.fm.intel.com with ESMTP; 06 Oct 2017 11:21:00 -0700 To: Xueming Li , Nelio Laranjeiro Cc: dev@dpdk.org References: <20170824140341.95471-1-xuemingl@mellanox.com> <20171006154552.161159-3-xuemingl@mellanox.com> From: Ferruh Yigit Message-ID: <9bd9343c-1bf1-33cf-fe6c-d3970bfa6a07@intel.com> Date: Fri, 6 Oct 2017 19:21:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171006154552.161159-3-xuemingl@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v5 2/5] net/mlx5: install a socket to exchange a file descriptor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2017 18:21:02 -0000 On 10/6/2017 4:45 PM, Xueming Li wrote: > Use a unix socket to get back the communication channel with the Kernel > driver from the primary process, this is necessary to remap those pages > in the secondary process memory space and thus use the same Tx queues. > > This is only supported from rdma-core (v15). > > Signed-off-by: Nelio Laranjeiro > Signed-off-by: Xueming Li <...> > +int > +priv_tx_uar_remap(struct priv *priv, int fd) > +{ > + unsigned int i, j; > + uintptr_t pages[priv->txqs_n]; > + unsigned int pages_n = 0; > + uintptr_t uar_va; > + void *addr; > + struct txq *txq; > + struct txq_ctrl *txq_ctrl; > + int already_mapped; > + size_t page_size = sysconf(_SC_PAGESIZE); > + > + /* > + * As rdma-core, UARs are mapped in size of OS page size. > + * Use aligned address to avoid duplicate mmap. > + * Ref to libmlx5 function: mlx5_init_context() > + */ > + for (i = 0; i != priv->txqs_n; ++i) { > + txq = (*priv->txqs)[i]; > + txq_ctrl = container_of(txq, struct txq_ctrl, txq); > + uar_va = (uintptr_t)txq_ctrl->txq.bf_reg; > + uar_va = RTE_ALIGN_FLOOR(uar_va, page_size); > + already_mapped = 0; > + for (j = 0; j != pages_n; ++j) { > + if (pages[j] == uar_va) { ICC generates following warning [1], but it looks like false positive, I will disable this warning for this file for ICC while applying, please double check final commit. [1] .../drivers/net/mlx5/mlx5_txq.c(608): error #3656: variable "pages" may be used before its value is set if (pages[j] == uar_va) { ^ > + already_mapped = 1; > + break; > + } > + } > + if (already_mapped) > + continue; > + pages[pages_n++] = uar_va; > + addr = mmap((void *)uar_va, page_size, > + PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, > + txq_ctrl->uar_mmap_offset); > + if (addr != (void *)uar_va) { > + ERROR("call to mmap failed on UAR for txq %d\n", i); > + return -1; > + } > + } > + return 0; > +} >