From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7494B436AC; Fri, 8 Dec 2023 18:23:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E0A043297; Fri, 8 Dec 2023 18:23:38 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id E2BBC43001 for ; Fri, 8 Dec 2023 18:23:36 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d0897e99e0so18094455ad.3 for ; Fri, 08 Dec 2023 09:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1702056216; x=1702661016; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=7DFFjJgfRxN/1neHQxGmrkYbp9Ex1J4L2Pr4zBfVvxs=; b=GIgIQiw18bezjuwpb84NhP5hCrUwHq4yMYI9Ia9cA9dWV1z4ogWj5Qfxv27t7XX7lA lYZn+7xsfmHRvbH3tXe17jGshwldT1RXvMT+3cV+Q22bsQ4S90chwZyX8Xj1+I2S7aDA 4YV6lN7XkTgjY0CIWFQf49mpUMGiBCdmLlHENcJGl2pdTMSgBdLXTFrJPrkJfZ6DX1Vh HbofesjLgGTy6U3DEeXf194kdoQRTAuGXT3bK2dNCe3g0iscju0DPpHUIPcsSSTvJafF GO4GzbPYWY3SZWqrih3pPsBsnwpqiiWWlNIB5rG9Jz9HqLI6L1lvcuUN3zFnfy23gkut S04w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702056216; x=1702661016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7DFFjJgfRxN/1neHQxGmrkYbp9Ex1J4L2Pr4zBfVvxs=; b=p0Z/GDT46xebXCeyE4bqlCK06gQDJEl7iOslQO3zhJKRn/lbLiy5TBQCSXtHp/aCd4 ahcrQYFihIVgTsVlc22by6YqhdoOuAMvgzJSZ0/02F7MKA+EU0iFtpWnO+tzqekcPQo3 CPLAf2pi44KjzDReAauBw+TAnh0TeQkifjlRY24+wWXMzSLyPlydHC0rZgrdsnarUC5A W6i3bke1qO1T3CO/I3C/TMzwEHw4TkZENEmXtdh0Xk1q8YEyq55s2Bz4MNqeZu6IpLyp bx8TJ1kYjjJMTzo3B/RdMcnjRjoKGq06a1LbP9uP3n9cjWCCzeo9xR/AKl15/5xHGQC4 coog== X-Gm-Message-State: AOJu0YxEHZ7OnTWSfRkoO2lSeTj1vUZWYAwziy4AjfsqyHaD3OwL1oSq hvXJ6Q2HZw9btfa0XgLUNRoyBQ== X-Google-Smtp-Source: AGHT+IHtJDS6p45h2FvMgdKsX/JQrvbmxWZdamhFppp5CElfinusePyFE1HZ7/Sp9FuIUNshR+8cWA== X-Received: by 2002:a17:902:ab86:b0:1d1:c917:2e57 with SMTP id f6-20020a170902ab8600b001d1c9172e57mr406374plr.6.1702056215995; Fri, 08 Dec 2023 09:23:35 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id y18-20020a170902b49200b001d1cda6bdfdsm1936149plr.34.2023.12.08.09.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:23:35 -0800 (PST) Date: Fri, 8 Dec 2023 09:23:34 -0800 From: Stephen Hemminger To: Maryam Tahhan Cc: "Koikkara Reeny, Shibin" , "ferruh.yigit@amd.com" , "lihuisong@huawei.com" , "fengchengwen@huawei.com" , "liuyonglong@huawei.com" , "dev@dpdk.org" Subject: Re: [v2] net/af_xdp: enable a sock path alongside use_cni Message-ID: <20231208092334.674210eb@hermes.local> In-Reply-To: References: <20231204103101.2124374-1-mtahhan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 4 Dec 2023 18:41:18 +0000 Maryam Tahhan wrote: > Hi Shibin >=20 > I'm not really sure what you are suggesting, is to make an assumption on= =20 > the path part where the socket resides (aka hard code it) and then try=20 > to build the full UDS path in DPDK? >=20 > Yes the plugin is using constants ATM for certain parts of the UDS path,= =20 > but that's not say that it's something that won't become configurable=20 > later on. Someone may not want to use "/tmp/afxdp_dp/" as the base=20 > directory. Then we'd have to change DPDK's implementation again. These=20 > are not really things that are configured by hand and are generated by=20 > initialization scripts (typically). I would rather build this with the=20 > idea that things can change in the future without having to change the=20 > DPDK implementation again. > BR > Maryam In UNIX(7) man page: abstract an abstract socket address is distinguished (from a pathn= ame socket) by the fact that sun_path[0] is a null byte ('\0'). = The socket's address in this namespace is given by the additio= nal bytes in sun_path that are covered by the specified length= of the address structure. (Null bytes in the name have no spec= ial significance.) The name has no connection with filesystem pa= th=E2=80=90 names. When the address of an abstract socket is returned, = the returned addrlen is greater than sizeof(sa_family_t) (i.= e., greater than 2), and the name of the socket is contained in = the first (addrlen - sizeof(sa_family_t)) bytes of sun_path. Something like this: diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_e= th_af_xdp.c index 353c8688ec9c..f41632a9df5a 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1362,7 +1362,10 @@ init_uds_sock(struct sockaddr_un *server) } =20 server->sun_family =3D AF_UNIX; - strlcpy(server->sun_path, UDS_SOCK, sizeof(server->sun_path)); + + /* Use an abstract socket (not in filesystem) */ + memset(server.sun_path, '\0', sizeof(server.sun_path)); + strlcpy(server->sun_path + 1, UDS_SOCK, sizeof(server->sun_path) - 1); =20 if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) = < 0) { close(sock); @@ -1393,7 +1396,10 @@ send_msg(int sock, char *request, int *fd) =20 memset(&dst, 0, sizeof(dst)); dst.sun_family =3D AF_UNIX; - strlcpy(dst.sun_path, UDS_SOCK, sizeof(dst.sun_path)); + + /* Use an abstract socket (not in filesystem) */ + memset(server.sun_path, '\0', sizeof(server.sun_path)); + strlcpy(server->sun_path + 1, UDS_SOCK, sizeof(server->sun_path) - 1); =20 /* Initialize message header structure */ memset(&msgh, 0, sizeof(msgh));