From: Stephen Hemminger <stephen@networkplumber.org>
To: Maryam Tahhan <mtahhan@redhat.com>
Cc: "Koikkara Reeny, Shibin" <shibin.koikkara.reeny@intel.com>,
"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
"lihuisong@huawei.com" <lihuisong@huawei.com>,
"fengchengwen@huawei.com" <fengchengwen@huawei.com>,
"liuyonglong@huawei.com" <liuyonglong@huawei.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [v2] net/af_xdp: enable a sock path alongside use_cni
Date: Fri, 8 Dec 2023 09:23:34 -0800 [thread overview]
Message-ID: <20231208092334.674210eb@hermes.local> (raw)
In-Reply-To: <dd62e743-7d01-4ec5-ac55-a153993c9080@redhat.com>
On Mon, 4 Dec 2023 18:41:18 +0000
Maryam Tahhan <mtahhan@redhat.com> wrote:
> Hi Shibin
>
> I'm not really sure what you are suggesting, is to make an assumption on
> the path part where the socket resides (aka hard code it) and then try
> to build the full UDS path in DPDK?
>
> Yes the plugin is using constants ATM for certain parts of the UDS path,
> but that's not say that it's something that won't become configurable
> later on. Someone may not want to use "/tmp/afxdp_dp/" as the base
> directory. Then we'd have to change DPDK's implementation again. These
> are not really things that are configured by hand and are generated by
> initialization scripts (typically). I would rather build this with the
> idea that things can change in the future without having to change the
> DPDK implementation again.
> BR
> Maryam
In UNIX(7) man page:
abstract
an abstract socket address is distinguished (from a pathname
socket) by the fact that sun_path[0] is a null byte ('\0'). The
socket's address in this namespace is given by the additional
bytes in sun_path that are covered by the specified length of
the address structure. (Null bytes in the name have no special
significance.) The name has no connection with filesystem path‐
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_eth_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)
}
server->sun_family = 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);
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)
memset(&dst, 0, sizeof(dst));
dst.sun_family = 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);
/* Initialize message header structure */
memset(&msgh, 0, sizeof(msgh));
next prev parent reply other threads:[~2023-12-08 17:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 10:31 Maryam Tahhan
2023-12-04 17:18 ` Koikkara Reeny, Shibin
2023-12-04 18:41 ` Maryam Tahhan
2023-12-05 10:29 ` Koikkara Reeny, Shibin
2023-12-05 11:28 ` Maryam Tahhan
2023-12-05 11:54 ` Koikkara Reeny, Shibin
2023-12-08 17:23 ` Stephen Hemminger [this message]
[not found] ` <CAFdtZit1v+F1UNve4wDtVJYMSPNMdFayPKHOpTyJsn_cVgMjRQ@mail.gmail.com>
2023-12-11 13:22 ` Maryam Tahhan
2023-12-05 11:31 ` Maryam Tahhan
2023-12-05 11:49 ` Koikkara Reeny, Shibin
2023-12-05 13:43 ` Loftus, Ciara
2023-12-05 14:38 ` Maryam Tahhan
2023-12-05 14:42 ` Koikkara Reeny, Shibin
2023-12-05 18:30 ` Stephen Hemminger
2023-12-06 15:00 ` Maryam Tahhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231208092334.674210eb@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=lihuisong@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=mtahhan@redhat.com \
--cc=shibin.koikkara.reeny@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).