Skip to contentSkip to conversation

devlink: fix couple of cosmetic issues

PATCH Applied Jiri Pirko 2 participants 4 messages Sep 29, 2022

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

cover devlink: fix couple of cosmetic issues

From: Jiri Pirko <[email protected]>

Just cosmetics, more or less.

Jiri Pirko (2):
devlink: move use_iec into struct dl
devlink: fix typo in variable name in ifname_map_cb()

 devlink/devlink.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
Signature · 1 line
2.37.1
author
#1 lore raw

PATCH 1/2 devlink: move use_iec into struct dl

From: Jiri Pirko <[email protected]>

Similar to other bool opts that could be set by the user, move the global variable use_iec to be part of struct dl.

---
 devlink/devlink.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
devlink/devlink.c +4 -5
index 4f77e42f2d48..0e194c9800b7 100644
@@ -71,8 +71,6 @@ static bool g_indent_newline;
 #define INDENT_STR_MAXLEN 32
 static char g_indent_str[INDENT_STR_MAXLEN + 1] = "";
 
-static bool use_iec = false;
-
 static void __attribute__((format(printf, 1, 2)))
 pr_err(const char *fmt, ...)
 {
@@ -374,6 +372,7 @@ struct dl {
 	bool verbose;
 	bool stats;
 	bool hex;
+	bool use_iec;
 	bool map_loaded;
 	struct {
 		bool present;
@@ -4926,7 +4925,7 @@ static void pr_out_port_fn_rate(struct dl *dl, struct nlattr **tb)
 			mnl_attr_get_u64(tb[DEVLINK_ATTR_RATE_TX_SHARE]);
 
 		if (rate)
-			print_rate(use_iec, PRINT_ANY, "tx_share",
+			print_rate(dl->use_iec, PRINT_ANY, "tx_share",
 				   " tx_share %s", rate);
 	}
 	if (tb[DEVLINK_ATTR_RATE_TX_MAX]) {
@@ -4934,7 +4933,7 @@ static void pr_out_port_fn_rate(struct dl *dl, struct nlattr **tb)
 			mnl_attr_get_u64(tb[DEVLINK_ATTR_RATE_TX_MAX]);
 
 		if (rate)
-			print_rate(use_iec, PRINT_ANY, "tx_max",
+			print_rate(dl->use_iec, PRINT_ANY, "tx_max",
 				   " tx_max %s", rate);
 	}
 	if (tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]) {
@@ -9739,7 +9738,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case 'i':
-			use_iec = true;
+			dl->use_iec = true;
 			break;
 		case 'x':
 			dl->hex = true;
Signature · 1 line
2.37.1
author
#2 lore raw

PATCH 2/2 devlink: fix typo in variable name in ifname_map_cb()

In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>

s/port_ifindex/port_index/

---
 devlink/devlink.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
devlink/devlink.c +3 -3
index 0e194c9800b7..8c02730b27a9 100644
@@ -782,7 +782,7 @@ static int ifname_map_cb(const struct nlmsghdr *nlh, void *data)
 	struct ifname_map *ifname_map;
 	const char *bus_name;
 	const char *dev_name;
-	uint32_t port_ifindex;
+	uint32_t port_index;
 	const char *port_ifname;
 
 	mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
@@ -795,10 +795,10 @@ static int ifname_map_cb(const struct nlmsghdr *nlh, void *data)
 
 	bus_name = mnl_attr_get_str(tb[DEVLINK_ATTR_BUS_NAME]);
 	dev_name = mnl_attr_get_str(tb[DEVLINK_ATTR_DEV_NAME]);
-	port_ifindex = mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]);
+	port_index = mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]);
 	port_ifname = mnl_attr_get_str(tb[DEVLINK_ATTR_PORT_NETDEV_NAME]);
 	ifname_map = ifname_map_alloc(bus_name, dev_name,
-				      port_ifindex, port_ifname);
+				      port_index, port_ifname);
 	if (!ifname_map)
 		return MNL_CB_ERROR;
 	list_add(&ifname_map->list, &dl->ifname_map_list);
Signature · 1 line
2.37.1
#3 lore raw
In reply to Jiri Pirko
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 9 lines · On Thu, 29 Sep 2022 12:24:34 +0200 you wrote:

From: Jiri Pirko <[email protected]>

Just cosmetics, more or less.

Jiri Pirko (2):
devlink: move use_iec into struct dl
devlink: fix typo in variable name in ifname_map_cb()

[...]

Here is the summary with links:
- [iproute2-next,1/2] devlink: move use_iec into struct dl

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=16d2732a5283
  - [iproute2-next,2/2] devlink: fix typo in variable name in ifname_map_cb()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=d8d3aadf347c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html