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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Mar 2020 18:21:02 +0000 (11:21 -0700)
In the commit f73b12812a3d
("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: f73b12812a3d ("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>
net/tipc/msg.h
net/tipc/node.c
net/tipc/socket.c

index 6d466ebdb64fb205600c79bf61d8ec63e0d22b17..871feadbbc1916adc1de3f78ae921f5aac1e712b 100644 (file)
@@ -394,6 +394,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 0c88778c88b5f142772330123998978fc50284a8..10292c942384dbb0fc51e9f931bd25fbacfeab6a 100644 (file)
@@ -1586,7 +1586,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 693e8902161efaa35f918dae4731a5c3a081c5fd..87466607097f18f5d6ea658e7123cf7ae949d775 100644 (file)
@@ -1461,7 +1461,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;