From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D1ED2A04B1; Mon, 5 Oct 2020 15:09:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 34C681B952; Mon, 5 Oct 2020 15:09:30 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 48DF81B7FA for ; Mon, 5 Oct 2020 15:09:28 +0200 (CEST) IronPort-SDR: jYjHu3Q9HMPDmxZYYcq7lAJ0JcUyiLhEbFDF/EKa4yZfCYrO4OFX1AoYStOfh/1AXO013XL2Rc cdC3Pv9umqlA== X-IronPort-AV: E=McAfee;i="6000,8403,9764"; a="160708725" X-IronPort-AV: E=Sophos;i="5.77,338,1596524400"; d="scan'208";a="160708725" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 06:09:26 -0700 IronPort-SDR: je7wnrZvbD8SWIwl6yII+ioDcdv1ZIjal9Zk0PwFyfzBkFUviUgD13DkHopS8apxZBxlklSIHS //oasy+pqDRQ== X-IronPort-AV: E=Sophos;i="5.77,338,1596524400"; d="scan'208";a="525607584" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.225.105]) ([10.213.225.105]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 06:09:25 -0700 To: Jakub Grajciar , dev@dpdk.org References: <20201005123900.32723-1-jgrajcia@cisco.com> From: Ferruh Yigit Message-ID: <5b874482-baaa-1a65-b101-983aa3bff5ee@intel.com> Date: Mon, 5 Oct 2020 14:09:20 +0100 MIME-Version: 1.0 In-Reply-To: <20201005123900.32723-1-jgrajcia@cisco.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] net/memif: use abstract socket address 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/5/2020 1:39 PM, Jakub Grajciar wrote: > Abstract socket address has no connection with > filesystem pathnames and the socket dissapears > once all open references are closed. > > Memif pmd will use abstract socket address by default. > For backwards compatibility use new argument > 'socket-abstract=no' > Why this backward compatibility is required? How the end user affected from swithching to abstract sockets? Since when linux supports abstract sockets, does this switch will cause problem with old kernel versions? Is there any benefit of the abstract sockets other than socket cleaned automatically (I assume for unix sockets it is done when file filesystem reference removed)? > Signed-off-by: Jakub Grajciar > --- > doc/guides/nics/memif.rst | 1 + > drivers/net/memif/memif_socket.c | 25 +++++++++++++++-------- > drivers/net/memif/rte_eth_memif.c | 34 ++++++++++++++++++++++++++++++- > drivers/net/memif/rte_eth_memif.h | 10 +++++---- > 4 files changed, 57 insertions(+), 13 deletions(-) > > diff --git a/doc/guides/nics/memif.rst b/doc/guides/nics/memif.rst > index ddeebed25..8e80105a4 100644 > --- a/doc/guides/nics/memif.rst > +++ b/doc/guides/nics/memif.rst > @@ -43,6 +43,7 @@ client. > "bsize=1024", "Size of single packet buffer", "2048", "uint16_t" > "rsize=11", "Log2 of ring size. If rsize is 10, actual ring size is 1024", "10", "1-14" > "socket=/tmp/memif.sock", "Socket filename", "/tmp/memif.sock", "string len 108" > + "socket-abstract=no", "Set usage of abstract socket address", "yes", "yes|no" > "mac=01:23:45:ab:cd:ef", "Mac address", "01:ab:23:cd:45:ef", "" > "secret=abc123", "Secret is an optional security option, which if specified, must be matched by peer", "", "string len 24" > "zero-copy=yes", "Enable/disable zero-copy slave mode. Only relevant to slave, requires '--single-file-segments' eal argument", "no", "yes|no" > diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c > index 67794cb6f..4b0b12ead 100644 > --- a/drivers/net/memif/memif_socket.c > +++ b/drivers/net/memif/memif_socket.c > @@ -862,10 +862,10 @@ memif_listener_handler(void *arg) > } > > static struct memif_socket * > -memif_socket_create(char *key, uint8_t listener) > +memif_socket_create(char *key, uint8_t listener, bool is_abstract) > { > struct memif_socket *sock; > - struct sockaddr_un un; > + struct sockaddr_un un = { 0 }; > int sockfd; > int ret; > int on = 1; > @@ -886,7 +886,12 @@ memif_socket_create(char *key, uint8_t listener) > goto error; > > un.sun_family = AF_UNIX; > - strlcpy(un.sun_path, sock->filename, MEMIF_SOCKET_UN_SIZE); > + if (is_abstract) { > + // abstract address Please don't prefer c99 comment sytle, there are a few occurrences below.