On Thu, Feb 03, 2022 at 01:44:12AM +0100, Ansuel Smith wrote: > Add support for cpu set useful to set CPU port for dsa devices.
Please also document the newly added 'cpu' parameter in the command- line output -- the manpage isn't even installed/available for OpenWrt users. > > Signed-off-by: Ansuel Smith <ansuels...@gmail.com> > --- > ...101-iplink_allow_to_change_cpu_value.patch | 81 +++++++++++++++++++ > 1 file changed, 81 insertions(+) > create mode 100644 > package/network/utils/iproute2/patches/101-iplink_allow_to_change_cpu_value.patch > > diff --git > a/package/network/utils/iproute2/patches/101-iplink_allow_to_change_cpu_value.patch > > b/package/network/utils/iproute2/patches/101-iplink_allow_to_change_cpu_value.patch > new file mode 100644 > index 00000000..1bb2bb1f > --- /dev/null > +++ > b/package/network/utils/iproute2/patches/101-iplink_allow_to_change_cpu_value.patch > @@ -0,0 +1,81 @@ > +From 8642516618b60a2827215f2bed54d4d0aa1da48a Mon Sep 17 00:00:00 2001 > +From: Ansuel Smith <ansuels...@gmail.com> > +Date: Sun, 23 Jan 2022 00:31:49 +0100 > +Subject: [PATCH] iplink: allow to change cpu of dsa device > + > +Allow to change the cpu port linked to a given dsa interface. > +This is useful in the case of multi-CPU port DSA to assign the correct > +port to the different user ports. > + > +Signed-off-by: Ansuel Smith <ansuels...@gmail.com> > +--- > + include/uapi/linux/if_link.h | 1 + > + ip/iplink.c | 7 +++++++ > + man/man8/ip-link.8.in | 7 +++++++ > + 3 files changed, 15 insertions(+) > + > +diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h > +index 41708e26..901b5544 100644 > +--- a/include/uapi/linux/if_link.h > ++++ b/include/uapi/linux/if_link.h > +@@ -341,6 +341,7 @@ enum { > + IFLA_ALT_IFNAME, /* Alternative ifname */ > + IFLA_PERM_ADDRESS, > + IFLA_PROTO_DOWN_REASON, > ++ IFLA_CPU, > + > + /* device (sysfs) name as parent, used instead > + * of IFLA_LINK where there's no parent netdev > +diff --git a/ip/iplink.c b/ip/iplink.c > +index a3ea775d..254c35c5 100644 > +--- a/ip/iplink.c > ++++ b/ip/iplink.c > +@@ -595,6 +595,7 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + int index = 0; > + int group = -1; > + int addr_len = 0; > ++ int cpu = -1; > + int err; > + > + ret = argc; > +@@ -625,6 +626,12 @@ int iplink_parse(int argc, char **argv, struct > iplink_req *req, char **type) > + } else if (matches(*argv, "link") == 0) { > + NEXT_ARG(); > + link = *argv; > ++ } else if (matches(*argv, "cpu") == 0) { > ++ NEXT_ARG(); > ++ cpu = ll_name_to_index(*argv); > ++ if (!cpu) > ++ return nodev(*argv); > ++ addattr32(&req->n, sizeof(*req), IFLA_CPU, cpu); > + } else if (matches(*argv, "address") == 0) { > + NEXT_ARG(); > + addr_len = ll_addr_a2n(abuf, sizeof(abuf), *argv); > +diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in > +index 19a0c9ca..406db8ad 100644 > +--- a/man/man8/ip-link.8.in > ++++ b/man/man8/ip-link.8.in > +@@ -152,6 +152,9 @@ ip-link \- network device configuration > + .br > + .RB "[ " nomaster " ]" > + .br > ++.RB "[ " cpu > ++.IR DEVICE " ]" > ++.br > + .RB "[ " vrf > + .IR NAME " ]" > + .br > +@@ -2299,6 +2302,10 @@ set master device of the device (enslave device). > + .BI nomaster > + unset master device of the device (release device). > + > ++.TP > ++.BI cpu " DEVICE" > ++set cpu device of the dsa device. > ++ > + .TP > + .BI addrgenmode " eui64|none|stable_secret|random" > + set the IPv6 address generation mode > +-- > +2.33.1 > + > -- > 2.34.1 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel