From: Daniel Machon <daniel.machon@microchip.com>
To: <netdev@vger.kernel.org>
Cc: <dsahern@kernel.org>, <stephen@networkplumber.org>,
<petrm@nvidia.com>, <UNGLinuxDriver@microchip.com>,
<daniel.machon@microchip.com>
Subject: [PATCH iproute2-next v2 1/8] dcb: app: add new dcbnl attribute field
Date: Thu, 25 May 2023 20:10:21 +0200 [thread overview]
Message-ID: <20230510-dcb-rewr-v2-1-9f38e688117e@microchip.com> (raw)
In-Reply-To: <20230510-dcb-rewr-v2-0-9f38e688117e@microchip.com>
Add a new field 'attr' to the dcb_app_table struct, in order to inject
different dcbnl get/set attributes for APP and rewrite.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
dcb/dcb_app.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
index eeb78e70f63f..8073415ad084 100644
--- a/dcb/dcb_app.c
+++ b/dcb/dcb_app.c
@@ -71,6 +71,7 @@ static void dcb_app_help(void)
struct dcb_app_table {
struct dcb_app *apps;
size_t n_apps;
+ int attr;
};
enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector)
@@ -583,7 +584,7 @@ static int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *t
void *payload;
int ret;
- ret = dcb_get_attribute_va(dcb, dev, DCB_ATTR_IEEE_APP_TABLE, &payload, &payload_len);
+ ret = dcb_get_attribute_va(dcb, dev, tab->attr, &payload, &payload_len);
if (ret != 0)
return ret;
@@ -606,7 +607,7 @@ static int dcb_app_add_del_cb(struct dcb *dcb, struct nlmsghdr *nlh, void *data)
struct nlattr *nest;
size_t i;
- nest = mnl_attr_nest_start(nlh, DCB_ATTR_IEEE_APP_TABLE);
+ nest = mnl_attr_nest_start(nlh, add_del->tab->attr);
for (i = 0; i < add_del->tab->n_apps; i++) {
const struct dcb_app *app = &add_del->tab->apps[i];
@@ -715,7 +716,7 @@ static int dcb_cmd_app_parse_add_del(struct dcb *dcb, const char *dev,
static int dcb_cmd_app_add(struct dcb *dcb, const char *dev, int argc, char **argv)
{
- struct dcb_app_table tab = {};
+ struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE };
int ret;
ret = dcb_cmd_app_parse_add_del(dcb, dev, argc, argv, &tab);
@@ -729,7 +730,7 @@ static int dcb_cmd_app_add(struct dcb *dcb, const char *dev, int argc, char **ar
static int dcb_cmd_app_del(struct dcb *dcb, const char *dev, int argc, char **argv)
{
- struct dcb_app_table tab = {};
+ struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE };
int ret;
ret = dcb_cmd_app_parse_add_del(dcb, dev, argc, argv, &tab);
@@ -743,7 +744,7 @@ static int dcb_cmd_app_del(struct dcb *dcb, const char *dev, int argc, char **ar
static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **argv)
{
- struct dcb_app_table tab = {};
+ struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE };
int ret;
ret = dcb_app_get(dcb, dev, &tab);
@@ -795,7 +796,7 @@ out:
static int dcb_cmd_app_flush(struct dcb *dcb, const char *dev, int argc, char **argv)
{
- struct dcb_app_table tab = {};
+ struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE };
int ret;
ret = dcb_app_get(dcb, dev, &tab);
@@ -848,9 +849,9 @@ out:
static int dcb_cmd_app_replace(struct dcb *dcb, const char *dev, int argc, char **argv)
{
- struct dcb_app_table orig = {};
- struct dcb_app_table tab = {};
- struct dcb_app_table new = {};
+ struct dcb_app_table orig = { .attr = DCB_ATTR_IEEE_APP_TABLE };
+ struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE };
+ struct dcb_app_table new = { .attr = DCB_ATTR_IEEE_APP_TABLE };
int ret;
ret = dcb_app_get(dcb, dev, &orig);
--
2.34.1
next prev parent reply other threads:[~2023-05-25 18:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 18:10 [PATCH iproute2-next v2 0/8] Introduce new dcb-rewr subcommand Daniel Machon
2023-05-25 18:10 ` Daniel Machon [this message]
2023-05-25 18:10 ` [PATCH iproute2-next v2 2/8] dcb: app: modify dcb-app print functions for dcb-rewr reuse Daniel Machon
2023-05-29 17:09 ` Petr Machata
2023-05-30 8:01 ` Daniel Machon
2023-05-31 8:31 ` Daniel Machon
2023-05-31 11:26 ` Petr Machata
2023-05-31 14:28 ` David Ahern
2023-05-25 18:10 ` [PATCH iproute2-next v2 3/8] dcb: app: modify dcb_app_table_remove_replaced() " Daniel Machon
2023-05-29 17:00 ` Petr Machata
2023-05-30 8:03 ` Daniel Machon
2023-05-30 20:29 ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 4/8] dcb: app: modify dcb_app_parse_mapping_cb " Daniel Machon
2023-05-30 19:50 ` Petr Machata
2023-05-31 8:12 ` Daniel Machon
2023-05-31 11:05 ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 5/8] dcb: rewr: add new dcb-rewr subcommand Daniel Machon
2023-05-30 19:58 ` Petr Machata
2023-05-31 8:14 ` Daniel Machon
2023-05-25 18:10 ` [PATCH iproute2-next v2 6/8] man: dcb-rewr: add new manpage for dcb-rewr Daniel Machon
2023-05-30 19:47 ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 7/8] man: dcb: add additional references under 'SEE ALSO' Daniel Machon
2023-05-30 19:39 ` Petr Machata
2023-05-25 18:10 ` [PATCH iproute2-next v2 8/8] man: dcb-app: clean up a few mistakes Daniel Machon
2023-05-30 19:37 ` Petr Machata
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=20230510-dcb-rewr-v2-1-9f38e688117e@microchip.com \
--to=daniel.machon@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=petrm@nvidia.com \
--cc=stephen@networkplumber.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).