]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tipc: Add a missing case of TIPC_DIRECT_MSG type
authorHoang Le <hoang.h.le@dektech.com.au>
Thu, 26 Mar 2020 02:50:29 +0000 (09:50 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:42:06 +0000 (11:42 +0100)
commit e2392ec2c46127665b5b995aaa88dca381dc63d3 upstream.

In the commit 5248c6f8694f
("tipc: improve throughput between nodes in netns"), we're missing a check
to handle TIPC_DIRECT_MSG type, it's still using old sending mechanism for
this message type. So, throughput improvement is not significant as
expected.

Besides that, when sending a large message with that type, we're also
handle wrong receiving queue, it should be enqueued in socket receiving
instead of multicast messages.

Fix this by adding the missing case for TIPC_DIRECT_MSG.

Fixes: 5248c6f8694f ("tipc: improve throughput between nodes in netns")
Reported-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tipc/msg.h
net/tipc/node.c
net/tipc/socket.c

index 2d7cb66a6912cb49a9fcfc6ed62f49bf269dab00..6d692546acdc332c45ca63a48c26fe6fb8790003 100644 (file)
@@ -358,6 +358,11 @@ static inline u32 msg_connected(struct tipc_msg *m)
        return msg_type(m) == TIPC_CONN_MSG;
 }
 
+static inline u32 msg_direct(struct tipc_msg *m)
+{
+       return msg_type(m) == TIPC_DIRECT_MSG;
+}
+
 static inline u32 msg_errcode(struct tipc_msg *m)
 {
        return msg_bits(m, 1, 25, 0xf);
index a6ac67c3877059f742e2364d7084cd582e9d6db1..125f3277fc6e07ec392a079af27d99d4d6ebbc0a 100644 (file)
@@ -1489,7 +1489,8 @@ static void tipc_lxc_xmit(struct net *peer_net, struct sk_buff_head *list)
        case TIPC_MEDIUM_IMPORTANCE:
        case TIPC_HIGH_IMPORTANCE:
        case TIPC_CRITICAL_IMPORTANCE:
-               if (msg_connected(hdr) || msg_named(hdr)) {
+               if (msg_connected(hdr) || msg_named(hdr) ||
+                   msg_direct(hdr)) {
                        tipc_loopback_trace(peer_net, list);
                        spin_lock_init(&list->lock);
                        tipc_sk_rcv(peer_net, list);
index e1e148da538d33fa7935aaeff31aeb5214c67430..cf4f90de566ed311953431c8140d5a252766db52 100644 (file)
@@ -1407,7 +1407,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
        }
 
        __skb_queue_head_init(&pkts);
-       mtu = tipc_node_get_mtu(net, dnode, tsk->portid, false);
+       mtu = tipc_node_get_mtu(net, dnode, tsk->portid, true);
        rc = tipc_msg_build(hdr, m, 0, dlen, mtu, &pkts);
        if (unlikely(rc != dlen))
                return rc;