DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 2/4] net/tap: rename struct nlmsg to tap_nlmsg
Date: Mon, 28 Oct 2024 09:32:10 -0700	[thread overview]
Message-ID: <20241028163324.193338-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20241028163324.193338-1-stephen@networkplumber.org>

The struct netlink message structure is part of the internal
TAP device API, not the netlink API itself. Use tap_ prefix
to avoid any confusion with nlmsghdr from netlink.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/tap_flow.c    | 22 +++++++++++-----------
 drivers/net/tap/tap_netlink.c |  4 ++--
 drivers/net/tap/tap_netlink.h |  6 +++---
 drivers/net/tap/tap_tcmsgs.c  | 10 +++++-----
 drivers/net/tap/tap_tcmsgs.h  |  2 +-
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index 51ec07eb5a..6564583174 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -35,7 +35,7 @@
 struct rte_flow {
 	LIST_ENTRY(rte_flow) next; /* Pointer to the next rte_flow structure */
 	struct rte_flow *remote_flow; /* associated remote flow */
-	struct nlmsg msg;
+	struct tap_nlmsg msg;
 };
 
 struct convert_data {
@@ -423,7 +423,7 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_eth *spec = item->spec;
 	const struct rte_flow_item_eth *mask = item->mask;
 	struct rte_flow *flow = info->flow;
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -477,7 +477,7 @@ tap_flow_create_vlan(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_vlan *spec = item->spec;
 	const struct rte_flow_item_vlan *mask = item->mask;
 	struct rte_flow *flow = info->flow;
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -537,7 +537,7 @@ tap_flow_create_ipv4(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_ipv4 *spec = item->spec;
 	const struct rte_flow_item_ipv4 *mask = item->mask;
 	struct rte_flow *flow = info->flow;
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -593,7 +593,7 @@ tap_flow_create_ipv6(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_ipv6 *mask = item->mask;
 	struct rte_flow *flow = info->flow;
 	uint8_t empty_addr[16] = { 0 };
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -648,7 +648,7 @@ tap_flow_create_udp(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_udp *spec = item->spec;
 	const struct rte_flow_item_udp *mask = item->mask;
 	struct rte_flow *flow = info->flow;
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -694,7 +694,7 @@ tap_flow_create_tcp(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_tcp *spec = item->spec;
 	const struct rte_flow_item_tcp *mask = item->mask;
 	struct rte_flow *flow = info->flow;
-	struct nlmsg *msg;
+	struct tap_nlmsg *msg;
 
 	/* use default mask if none provided */
 	if (!mask)
@@ -820,7 +820,7 @@ tap_flow_item_validate(const struct rte_flow_item *item,
 static int
 add_action(struct rte_flow *flow, size_t *act_index, struct action_data *adata)
 {
-	struct nlmsg *msg = &flow->msg;
+	struct tap_nlmsg *msg = &flow->msg;
 
 	if (tap_nlattr_nested_start(msg, (*act_index)++) < 0)
 		return -1;
@@ -891,7 +891,7 @@ static int
 add_actions(struct rte_flow *flow, int nb_actions, struct action_data *data,
 	    int classifier_action)
 {
-	struct nlmsg *msg = &flow->msg;
+	struct tap_nlmsg *msg = &flow->msg;
 	size_t act_index = 1;
 	int i;
 
@@ -1274,7 +1274,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct rte_flow *remote_flow = NULL;
 	struct rte_flow *flow = NULL;
-	struct nlmsg *msg = NULL;
+	struct tap_nlmsg *msg = NULL;
 	int err;
 
 	if (!pmd->if_index) {
@@ -1593,7 +1593,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,
 	struct rte_flow_item_eth eth_local = { .hdr.ether_type = 0 };
 	unsigned int if_index = pmd->remote_if_index;
 	struct rte_flow *remote_flow = NULL;
-	struct nlmsg *msg = NULL;
+	struct tap_nlmsg *msg = NULL;
 	int err = 0;
 	struct rte_flow_item items_local[2] = {
 		[0] = {
diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 35c491ac37..8a57c9242c 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -368,7 +368,7 @@ tap_nlattr_add32(struct nlmsghdr *nh, unsigned short type, uint32_t data)
  *   -1 if adding a nested netlink attribute failed, 0 otherwise.
  */
 int
-tap_nlattr_nested_start(struct nlmsg *msg, uint16_t type)
+tap_nlattr_nested_start(struct tap_nlmsg *msg, uint16_t type)
 {
 	struct nested_tail *tail;
 
@@ -400,7 +400,7 @@ tap_nlattr_nested_start(struct nlmsg *msg, uint16_t type)
  *   The netlink message where to edit the nested_tails metadata.
  */
 void
-tap_nlattr_nested_finish(struct nlmsg *msg)
+tap_nlattr_nested_finish(struct tap_nlmsg *msg)
 {
 	struct nested_tail *tail = msg->nested_tails;
 
diff --git a/drivers/net/tap/tap_netlink.h b/drivers/net/tap/tap_netlink.h
index faa73ba163..466c47a6d7 100644
--- a/drivers/net/tap/tap_netlink.h
+++ b/drivers/net/tap/tap_netlink.h
@@ -16,7 +16,7 @@
 
 #define NLMSG_BUF 512
 
-struct nlmsg {
+struct tap_nlmsg {
 	struct nlmsghdr nh;
 	struct tcmsg t;
 	char buf[NLMSG_BUF];
@@ -36,7 +36,7 @@ void tap_nlattr_add(struct nlmsghdr *nh, unsigned short type,
 void tap_nlattr_add8(struct nlmsghdr *nh, unsigned short type, uint8_t data);
 void tap_nlattr_add16(struct nlmsghdr *nh, unsigned short type, uint16_t data);
 void tap_nlattr_add32(struct nlmsghdr *nh, unsigned short type, uint32_t data);
-int tap_nlattr_nested_start(struct nlmsg *msg, uint16_t type);
-void tap_nlattr_nested_finish(struct nlmsg *msg);
+int tap_nlattr_nested_start(struct tap_nlmsg *msg, uint16_t type);
+void tap_nlattr_nested_finish(struct tap_nlmsg *msg);
 
 #endif /* _TAP_NETLINK_H_ */
diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c
index a3aae3c814..1755b57519 100644
--- a/drivers/net/tap/tap_tcmsgs.c
+++ b/drivers/net/tap/tap_tcmsgs.c
@@ -42,7 +42,7 @@ struct qdisc_custom_arg {
  *   Overrides the default netlink flags for this msg with those specified.
  */
 void
-tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags)
+tc_init_msg(struct tap_nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags)
 {
 	struct nlmsghdr *n = &msg->nh;
 
@@ -72,7 +72,7 @@ tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t fla
 static int
 qdisc_del(int nlsk_fd, unsigned int ifindex, struct qdisc *qinfo)
 {
-	struct nlmsg msg;
+	struct tap_nlmsg msg;
 	int fd = 0;
 
 	tc_init_msg(&msg, ifindex, RTM_DELQDISC, 0);
@@ -117,7 +117,7 @@ int
 qdisc_add_multiq(int nlsk_fd, unsigned int ifindex)
 {
 	struct tc_multiq_qopt opt = {0};
-	struct nlmsg msg;
+	struct tap_nlmsg msg;
 
 	tc_init_msg(&msg, ifindex, RTM_NEWQDISC,
 		    NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE);
@@ -146,7 +146,7 @@ qdisc_add_multiq(int nlsk_fd, unsigned int ifindex)
 int
 qdisc_add_ingress(int nlsk_fd, unsigned int ifindex)
 {
-	struct nlmsg msg;
+	struct tap_nlmsg msg;
 
 	tc_init_msg(&msg, ifindex, RTM_NEWQDISC,
 		    NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE);
@@ -211,7 +211,7 @@ static int
 qdisc_iterate(int nlsk_fd, unsigned int ifindex,
 	      int (*callback)(struct nlmsghdr *, void *), void *arg)
 {
-	struct nlmsg msg;
+	struct tap_nlmsg msg;
 	struct list_args args = {
 		.nlsk_fd = nlsk_fd,
 		.ifindex = ifindex,
diff --git a/drivers/net/tap/tap_tcmsgs.h b/drivers/net/tap/tap_tcmsgs.h
index 9411626661..70e97e2b62 100644
--- a/drivers/net/tap/tap_tcmsgs.h
+++ b/drivers/net/tap/tap_tcmsgs.h
@@ -24,7 +24,7 @@
 
 #define MULTIQ_MAJOR_HANDLE (1 << 16)
 
-void tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type,
+void tc_init_msg(struct tap_nlmsg *msg, unsigned int ifindex, uint16_t type,
 		 uint16_t flags);
 int qdisc_list(int nlsk_fd, unsigned int ifindex);
 int qdisc_flush(int nlsk_fd, unsigned int ifindex);
-- 
2.45.2


  parent reply	other threads:[~2024-10-28 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28 16:32 [PATCH 0/4] net/tap: minor cleanups Stephen Hemminger
2024-10-28 16:32 ` [PATCH 1/4] net/tap: replace rte_memcpy Stephen Hemminger
2024-10-28 16:32 ` Stephen Hemminger [this message]
2024-10-28 16:32 ` [PATCH 3/4] net/tap: do not use opaque parameter in convert Stephen Hemminger
2024-10-28 16:32 ` [PATCH 4/4] net/tap: do not use rte_malloc for process private data Stephen Hemminger

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=20241028163324.193338-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /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).