From f3188cfa392afdbacb171a367641504850645ea4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 4 Dec 2018 14:19:33 -0800 Subject: [PATCH 1/7] devlink: don't need to call pkg-config twice pkg-config for libmnl is already done in config.mk Signed-off-by: Stephen Hemminger --- devlink/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/devlink/Makefile b/devlink/Makefile index ace34c7b..040b942e 100644 --- a/devlink/Makefile +++ b/devlink/Makefile @@ -8,9 +8,6 @@ ifeq ($(HAVE_MNL),y) DEVLINKOBJ = devlink.o mnlg.o TARGETS += devlink -CFLAGS += $(shell $(PKG_CONFIG) libmnl --cflags) -LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) - endif all: $(TARGETS) $(LIBS) From a7a7e4501732bcdb6004271f12beda358ab4f463 Mon Sep 17 00:00:00 2001 From: Emeric Dupont Date: Mon, 3 Dec 2018 12:13:06 +0100 Subject: [PATCH 2/7] iproute2: Installation errors without libmnl When performing make install in iproute2 (current git master), if $(HAVE_MNL) is not selected, some Makefiles try to call install with an empty target, which causes a non-critical make error. Signed-off-by: Emeric Dupont Signed-off-by: Stephen Hemminger --- devlink/Makefile | 4 +++- rdma/Makefile | 4 +++- tipc/Makefile | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/devlink/Makefile b/devlink/Makefile index 040b942e..7da7d1fa 100644 --- a/devlink/Makefile +++ b/devlink/Makefile @@ -16,7 +16,9 @@ devlink: $(DEVLINKOBJ) $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ install: all - install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) + for i in $(TARGETS); \ + do install -m 0755 $$i $(DESTDIR)$(SBINDIR); \ + done clean: rm -f $(DEVLINKOBJ) $(TARGETS) diff --git a/rdma/Makefile b/rdma/Makefile index 819fcbe3..0498994f 100644 --- a/rdma/Makefile +++ b/rdma/Makefile @@ -17,7 +17,9 @@ rdma: $(RDMA_OBJ) $(LIBS) $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ install: all - install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) + for i in $(TARGETS); \ + do install -m 0755 $$i $(DESTDIR)$(SBINDIR); \ + done clean: rm -f $(RDMA_OBJ) $(TARGETS) diff --git a/tipc/Makefile b/tipc/Makefile index fdb18d39..a10debe0 100644 --- a/tipc/Makefile +++ b/tipc/Makefile @@ -22,7 +22,9 @@ tipc: $(TIPCOBJ) $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ install: all - install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) + for i in $(TARGETS); \ + do install -m 0755 $$i $(DESTDIR)$(SBINDIR); \ + done clean: rm -f $(TIPCOBJ) $(TARGETS) From 0951cbcddf5ade08a42ff8ce65bb9b2017ec9cee Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Tue, 4 Dec 2018 16:07:41 +0000 Subject: [PATCH 3/7] libnetlink: Process further iovs on no error When no error is reported in the first iov, do not prematurely return, but process further iovs. This fixes batch processing. Fixes: c60389e4f9ea ("libnetlink: fix leak and using unused memory on error") Signed-off-by: Petr Machata Signed-off-by: Stephen Hemminger --- lib/libnetlink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libnetlink.c b/lib/libnetlink.c index c0b80ed6..95457109 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -763,6 +763,7 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov, msg.msg_iovlen = 1; i = 0; while (1) { +next: status = rtnl_recvmsg(rtnl->fd, &msg, &buf); ++i; @@ -826,6 +827,8 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov, else free(buf); + if (i < iovlen) + goto next; return error ? -i : 0; } From 4ac421746417bf5166ad2dd0556b7138b276a807 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Tue, 4 Dec 2018 16:07:42 +0000 Subject: [PATCH 4/7] testsuite: Add a test for batch processing Test that when a second or following command in a batch fails, tc reports it correctly. This is a test for the previous patch. Signed-off-by: Petr Machata Signed-off-by: Stephen Hemminger --- testsuite/tests/tc/batch.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 testsuite/tests/tc/batch.t diff --git a/testsuite/tests/tc/batch.t b/testsuite/tests/tc/batch.t new file mode 100755 index 00000000..50e7ba37 --- /dev/null +++ b/testsuite/tests/tc/batch.t @@ -0,0 +1,23 @@ +#!/bin/sh +. lib/generic.sh + +DEV="$(rand_dev)" +ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV type dummy +ts_ip "$0" "Enable $DEV" link set $DEV up +ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV clsact + +TMP="$(mktemp)" +echo filt add dev $DEV ingress pref 1000 matchall action pass >> "$TMP" +echo filt add dev $DEV ingress pref 1000 matchall action pass >> "$TMP" + +"$TC" -b "$TMP" 2> $STD_ERR > $STD_OUT +if [ $? -eq 0 ]; then + ts_err "$0: batch passed when it should have failed" +elif [ ! -s $STD_ERR ]; then + ts_err "$0: batch produced no error message" +else + echo "$0: batch failed, as expected" +fi + +rm "$TMP" +ts_ip "$0" "Del $DEV dummy interface" link del dev $DEV From 2e320d8b7e74d667628ede35d2ec0340347cd2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Je=C5=99=C3=A1bek?= Date: Wed, 5 Dec 2018 16:39:20 +0100 Subject: [PATCH 5/7] ip: iplink_can.c: fix json formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the CAN state was always printed in human-readable txt format, resulting in invalid JSON. Signed-off-by: Martin Jeřábek Signed-off-by: Stephen Hemminger --- ip/iplink_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index c0deeb1f..5bf490a9 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -283,7 +283,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) if (tb[IFLA_CAN_STATE]) { uint32_t state = rta_getattr_u32(tb[IFLA_CAN_STATE]); - fprintf(f, "state %s ", state < CAN_STATE_MAX ? + print_string(PRINT_ANY, "state", "state %s ", state < CAN_STATE_MAX ? can_state_names[state] : "UNKNOWN"); } From 853adffe13dfa0fb00a0e0b589ffba4e12fc06c2 Mon Sep 17 00:00:00 2001 From: Hoang Le Date: Thu, 6 Dec 2018 08:40:06 +0700 Subject: [PATCH 6/7] tipc: fix misalignment printout in non-JSON output In the commit 1304f50a5be0ed ("tipc: JSON support for showing nametable"), introduced misalignment in the columns of the printout in non-JSON mode compare to the list header. Add one space per column to make alignment with the list header. before: $tipc name show Type Lower Upper Scope Port Node 1 1 1 node 4071367628 after: $tipc name show Type Lower Upper Scope Port Node 1 1 1 node 4071367628 Reported-by: Jon Maloy Acked-by: Jon Maloy Signed-off-by: Hoang Le Signed-off-by: Stephen Hemminger --- tipc/nametable.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tipc/nametable.c b/tipc/nametable.c index eb4bd0bd..d899eeb6 100644 --- a/tipc/nametable.c +++ b/tipc/nametable.c @@ -58,14 +58,19 @@ static int nametable_show_cb(const struct nlmsghdr *nlh, void *data) open_json_object(NULL); print_uint(PRINT_ANY, "type", "%-10u", mnl_attr_get_u32(publ[TIPC_NLA_PUBL_TYPE])); + print_string(PRINT_FP, NULL, " ", ""); print_uint(PRINT_ANY, "lower", "%-10u", mnl_attr_get_u32(publ[TIPC_NLA_PUBL_LOWER])); + print_string(PRINT_FP, NULL, " ", ""); print_uint(PRINT_ANY, "upper", "%-10u", mnl_attr_get_u32(publ[TIPC_NLA_PUBL_UPPER])); + print_string(PRINT_FP, NULL, " ", ""); print_string(PRINT_ANY, "scope", "%-8s", scope[mnl_attr_get_u32(publ[TIPC_NLA_PUBL_SCOPE])]); + print_string(PRINT_FP, NULL, " ", ""); print_uint(PRINT_ANY, "port", "%-10u", mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF])); + print_string(PRINT_FP, NULL, " ", ""); print_string(PRINT_ANY, "node", "%s", str); print_string(PRINT_FP, NULL, "\n", ""); close_json_object(); From a9c49b8f8fa92c2823d5fd706626d1e5f9490f23 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 7 Dec 2018 09:25:59 -0800 Subject: [PATCH 7/7] rdma: align uapi headers with 4.20-rc5 Upstream headers were updated. Signed-off-by: Stephen Hemminger --- rdma/include/uapi/rdma/ib_user_verbs.h | 20 +++++++++++++++++++- rdma/include/uapi/rdma/rdma_netlink.h | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/rdma/include/uapi/rdma/ib_user_verbs.h b/rdma/include/uapi/rdma/ib_user_verbs.h index 25a16760..1254b51a 100644 --- a/rdma/include/uapi/rdma/ib_user_verbs.h +++ b/rdma/include/uapi/rdma/ib_user_verbs.h @@ -763,10 +763,28 @@ struct ib_uverbs_sge { __u32 lkey; }; +enum ib_uverbs_wr_opcode { + IB_UVERBS_WR_RDMA_WRITE = 0, + IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, + IB_UVERBS_WR_SEND = 2, + IB_UVERBS_WR_SEND_WITH_IMM = 3, + IB_UVERBS_WR_RDMA_READ = 4, + IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, + IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, + IB_UVERBS_WR_LOCAL_INV = 7, + IB_UVERBS_WR_BIND_MW = 8, + IB_UVERBS_WR_SEND_WITH_INV = 9, + IB_UVERBS_WR_TSO = 10, + IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, + IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, + IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, + /* Review enum ib_wr_opcode before modifying this */ +}; + struct ib_uverbs_send_wr { __aligned_u64 wr_id; __u32 num_sge; - __u32 opcode; + __u32 opcode; /* see enum ib_uverbs_wr_opcode */ __u32 send_flags; union { __be32 imm_data; diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index 6513fb89..e2228c09 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -227,8 +227,9 @@ enum rdma_nldev_command { RDMA_NLDEV_CMD_UNSPEC, RDMA_NLDEV_CMD_GET, /* can dump */ + RDMA_NLDEV_CMD_SET, - /* 2 - 4 are free to use */ + /* 3 - 4 are free to use */ RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */