|
|
4aca6e |
From a3ad974e186f36ac599e99ad324ae1790f6fdf4a Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Fri, 17 Mar 2017 13:22:19 +0100
|
|
|
4aca6e |
Subject: [PATCH] tc: flower checkpatch cleanups
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 512caeb2737f1
|
|
|
4aca6e |
Conflicts: Whitespace changes in removed code.
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 512caeb2737f1657d941945cc770a95882e1c1bb
|
|
|
4aca6e |
Author: Stephen Hemminger <sthemmin@microsoft.com>
|
|
|
4aca6e |
Date: Tue Nov 29 11:48:52 2016 -0800
|
|
|
4aca6e |
|
|
|
4aca6e |
tc: flower checkpatch cleanups
|
|
|
4aca6e |
|
|
|
4aca6e |
break long lines and minor whitespace changes.
|
|
|
4aca6e |
---
|
|
|
4aca6e |
tc/f_flower.c | 71 ++++++++++++++++++++++++++++++++---------------------------
|
|
|
4aca6e |
1 file changed, 38 insertions(+), 33 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/tc/f_flower.c b/tc/f_flower.c
|
|
|
4aca6e |
index dec7d9d..874a7bd 100644
|
|
|
4aca6e |
--- a/tc/f_flower.c
|
|
|
4aca6e |
+++ b/tc/f_flower.c
|
|
|
4aca6e |
@@ -25,29 +25,30 @@
|
|
|
4aca6e |
|
|
|
4aca6e |
static void explain(void)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- fprintf(stderr, "Usage: ... flower [ MATCH-LIST ]\n");
|
|
|
4aca6e |
- fprintf(stderr, " [ skip_sw | skip_hw ]\n");
|
|
|
4aca6e |
- fprintf(stderr, " [ action ACTION-SPEC ] [ classid CLASSID ]\n");
|
|
|
4aca6e |
- fprintf(stderr, "\n");
|
|
|
4aca6e |
- fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n");
|
|
|
4aca6e |
- fprintf(stderr, " MATCH := { indev DEV-NAME | \n");
|
|
|
4aca6e |
- fprintf(stderr, " vlan_id VID |\n");
|
|
|
4aca6e |
- fprintf(stderr, " vlan_prio PRIORITY |\n");
|
|
|
4aca6e |
- fprintf(stderr, " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n");
|
|
|
4aca6e |
- fprintf(stderr, " dst_mac MAC-ADDR | \n");
|
|
|
4aca6e |
- fprintf(stderr, " src_mac MAC-ADDR | \n");
|
|
|
4aca6e |
- fprintf(stderr, " [ipv4 | ipv6 ] | \n");
|
|
|
4aca6e |
- fprintf(stderr, " ip_proto [tcp | udp | IP-PROTO ] | \n");
|
|
|
4aca6e |
- fprintf(stderr, " dst_ip [ IPV4-ADDR | IPV6-ADDR ] | \n");
|
|
|
4aca6e |
- fprintf(stderr, " src_ip [ IPV4-ADDR | IPV6-ADDR ] | \n");
|
|
|
4aca6e |
- fprintf(stderr, " dst_port PORT-NUMBER | \n");
|
|
|
4aca6e |
- fprintf(stderr, " src_port PORT-NUMBER }\n");
|
|
|
4aca6e |
- fprintf(stderr, " FILTERID := X:Y:Z\n");
|
|
|
4aca6e |
- fprintf(stderr, " ACTION-SPEC := ... look at individual actions\n");
|
|
|
4aca6e |
- fprintf(stderr, "\n");
|
|
|
4aca6e |
- fprintf(stderr, "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n");
|
|
|
4aca6e |
- fprintf(stderr, "NOTE: There can be only used one mask per one prio. If user needs\n");
|
|
|
4aca6e |
- fprintf(stderr, " to specify different mask, he has to use different prio.\n");
|
|
|
4aca6e |
+ fprintf(stderr,
|
|
|
4aca6e |
+ "Usage: ... flower [ MATCH-LIST ]\n"
|
|
|
4aca6e |
+ " [ skip_sw | skip_hw ]\n"
|
|
|
4aca6e |
+ " [ action ACTION-SPEC ] [ classid CLASSID ]\n"
|
|
|
4aca6e |
+ "\n"
|
|
|
4aca6e |
+ "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"
|
|
|
4aca6e |
+ " MATCH := { indev DEV-NAME |\n"
|
|
|
4aca6e |
+ " vlan_id VID |\n"
|
|
|
4aca6e |
+ " vlan_prio PRIORITY |\n"
|
|
|
4aca6e |
+ " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n"
|
|
|
4aca6e |
+ " dst_mac MAC-ADDR |\n"
|
|
|
4aca6e |
+ " src_mac MAC-ADDR |\n"
|
|
|
4aca6e |
+ " [ipv4 | ipv6 ] |\n"
|
|
|
4aca6e |
+ " ip_proto [tcp | udp | IP-PROTO ] |\n"
|
|
|
4aca6e |
+ " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n"
|
|
|
4aca6e |
+ " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n"
|
|
|
4aca6e |
+ " dst_port PORT-NUMBER |\n"
|
|
|
4aca6e |
+ " src_port PORT-NUMBER }\n"
|
|
|
4aca6e |
+ " FILTERID := X:Y:Z\n"
|
|
|
4aca6e |
+ " ACTION-SPEC := ... look at individual actions\n"
|
|
|
4aca6e |
+ "\n"
|
|
|
4aca6e |
+ "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n"
|
|
|
4aca6e |
+ "NOTE: There can be only used one mask per one prio. If user needs\n"
|
|
|
4aca6e |
+ " to specify different mask, he has to use different prio.\n");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
static int flower_parse_eth_addr(char *str, int addr_type, int mask_type,
|
|
|
4aca6e |
@@ -66,12 +67,14 @@ static int flower_parse_eth_addr(char *str, int addr_type, int mask_type,
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type,
|
|
|
4aca6e |
- __be16 *p_vlan_eth_type, struct nlmsghdr *n)
|
|
|
4aca6e |
+ __be16 *p_vlan_eth_type,
|
|
|
4aca6e |
+ struct nlmsghdr *n)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
__be16 vlan_eth_type;
|
|
|
4aca6e |
|
|
|
4aca6e |
if (eth_type != htons(ETH_P_8021Q)) {
|
|
|
4aca6e |
- fprintf(stderr, "Can't set \"vlan_ethtype\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
+ fprintf(stderr,
|
|
|
4aca6e |
+ "Can't set \"vlan_ethtype\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -236,7 +239,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
|
|
|
4aca6e |
|
|
|
4aca6e |
NEXT_ARG();
|
|
|
4aca6e |
if (eth_type != htons(ETH_P_8021Q)) {
|
|
|
4aca6e |
- fprintf(stderr, "Can't set \"vlan_id\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
+ fprintf(stderr,
|
|
|
4aca6e |
+ "Can't set \"vlan_id\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
ret = get_u16(&vid, *argv, 10);
|
|
|
4aca6e |
@@ -250,7 +254,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
|
|
|
4aca6e |
|
|
|
4aca6e |
NEXT_ARG();
|
|
|
4aca6e |
if (eth_type != htons(ETH_P_8021Q)) {
|
|
|
4aca6e |
- fprintf(stderr, "Can't set \"vlan_prio\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
+ fprintf(stderr,
|
|
|
4aca6e |
+ "Can't set \"vlan_prio\" if ethertype isn't 802.1Q\n");
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
ret = get_u8(&vlan_prio, *argv, 10);
|
|
|
4aca6e |
@@ -258,12 +263,13 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
|
|
|
4aca6e |
fprintf(stderr, "Illegal \"vlan_prio\"\n");
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
- addattr8(n, MAX_MSG, TCA_FLOWER_KEY_VLAN_PRIO, vlan_prio);
|
|
|
4aca6e |
+ addattr8(n, MAX_MSG,
|
|
|
4aca6e |
+ TCA_FLOWER_KEY_VLAN_PRIO, vlan_prio);
|
|
|
4aca6e |
} else if (matches(*argv, "vlan_ethtype") == 0) {
|
|
|
4aca6e |
NEXT_ARG();
|
|
|
4aca6e |
ret = flower_parse_vlan_eth_type(*argv, eth_type,
|
|
|
4aca6e |
- TCA_FLOWER_KEY_VLAN_ETH_TYPE,
|
|
|
4aca6e |
- &vlan_ethtype, n);
|
|
|
4aca6e |
+ TCA_FLOWER_KEY_VLAN_ETH_TYPE,
|
|
|
4aca6e |
+ &vlan_ethtype, n);
|
|
|
4aca6e |
if (ret < 0)
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
} else if (matches(*argv, "dst_mac") == 0) {
|
|
|
4aca6e |
@@ -578,7 +584,7 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
|
|
|
4aca6e |
tb[TCA_FLOWER_KEY_TCP_SRC],
|
|
|
4aca6e |
tb[TCA_FLOWER_KEY_UDP_SRC]);
|
|
|
4aca6e |
|
|
|
4aca6e |
- if (tb[TCA_FLOWER_FLAGS]) {
|
|
|
4aca6e |
+ if (tb[TCA_FLOWER_FLAGS]) {
|
|
|
4aca6e |
__u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (flags & TCA_CLS_FLAGS_SKIP_HW)
|
|
|
4aca6e |
@@ -587,9 +593,8 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
|
|
|
4aca6e |
fprintf(f, "\n skip_sw");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
- if (tb[TCA_FLOWER_ACT]) {
|
|
|
4aca6e |
+ if (tb[TCA_FLOWER_ACT])
|
|
|
4aca6e |
tc_print_action(f, tb[TCA_FLOWER_ACT]);
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
|
|
|
4aca6e |
return 0;
|
|
|
4aca6e |
}
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|