Commit 872619d8 authored by GhantaKrishnamurthy MohanKrishna's avatar GhantaKrishnamurthy MohanKrishna Committed by David S. Miller

tipc: step sk->sk_drops when rcv buffer is full

Currently when tipc is unable to queue a received message on a
socket, the message is rejected back to the sender with error
TIPC_ERR_OVERLOAD. However, the application on this socket
has no knowledge about these discards.

In this commit, we try to step the sk_drops counter when tipc
is unable to queue a received message. Export sk_drops
using tipc socket diagnostics.
Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Acked-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarGhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Signed-off-by: default avatarParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c30b70de
...@@ -251,6 +251,7 @@ enum { ...@@ -251,6 +251,7 @@ enum {
TIPC_NLA_SOCK_STAT_SENDQ, /* u32 */ TIPC_NLA_SOCK_STAT_SENDQ, /* u32 */
TIPC_NLA_SOCK_STAT_LINK_CONG, /* flag */ TIPC_NLA_SOCK_STAT_LINK_CONG, /* flag */
TIPC_NLA_SOCK_STAT_CONN_CONG, /* flag */ TIPC_NLA_SOCK_STAT_CONN_CONG, /* flag */
TIPC_NLA_SOCK_STAT_DROP, /* u32 */
__TIPC_NLA_SOCK_STAT_MAX, __TIPC_NLA_SOCK_STAT_MAX,
TIPC_NLA_SOCK_STAT_MAX = __TIPC_NLA_SOCK_STAT_MAX - 1 TIPC_NLA_SOCK_STAT_MAX = __TIPC_NLA_SOCK_STAT_MAX - 1
......
...@@ -2122,8 +2122,10 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb, ...@@ -2122,8 +2122,10 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb,
(!sk_conn && msg_connected(hdr)) || (!sk_conn && msg_connected(hdr)) ||
(!grp && msg_in_group(hdr))) (!grp && msg_in_group(hdr)))
err = TIPC_ERR_NO_PORT; err = TIPC_ERR_NO_PORT;
else if (sk_rmem_alloc_get(sk) + skb->truesize >= limit) else if (sk_rmem_alloc_get(sk) + skb->truesize >= limit) {
atomic_inc(&sk->sk_drops);
err = TIPC_ERR_OVERLOAD; err = TIPC_ERR_OVERLOAD;
}
if (unlikely(err)) { if (unlikely(err)) {
tipc_skb_reject(net, err, skb, xmitq); tipc_skb_reject(net, err, skb, xmitq);
...@@ -2202,6 +2204,7 @@ static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, ...@@ -2202,6 +2204,7 @@ static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
/* Overload => reject message back to sender */ /* Overload => reject message back to sender */
onode = tipc_own_addr(sock_net(sk)); onode = tipc_own_addr(sock_net(sk));
atomic_inc(&sk->sk_drops);
if (tipc_msg_reverse(onode, &skb, TIPC_ERR_OVERLOAD)) if (tipc_msg_reverse(onode, &skb, TIPC_ERR_OVERLOAD))
__skb_queue_tail(xmitq, skb); __skb_queue_tail(xmitq, skb);
break; break;
...@@ -3293,7 +3296,9 @@ int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct tipc_sock *tsk, ...@@ -3293,7 +3296,9 @@ int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct tipc_sock *tsk,
if (nla_put_u32(skb, TIPC_NLA_SOCK_STAT_RCVQ, if (nla_put_u32(skb, TIPC_NLA_SOCK_STAT_RCVQ,
skb_queue_len(&sk->sk_receive_queue)) || skb_queue_len(&sk->sk_receive_queue)) ||
nla_put_u32(skb, TIPC_NLA_SOCK_STAT_SENDQ, nla_put_u32(skb, TIPC_NLA_SOCK_STAT_SENDQ,
skb_queue_len(&sk->sk_write_queue))) skb_queue_len(&sk->sk_write_queue)) ||
nla_put_u32(skb, TIPC_NLA_SOCK_STAT_DROP,
atomic_read(&sk->sk_drops)))
goto stat_msg_cancel; goto stat_msg_cancel;
if (tsk->cong_link_cnt && if (tsk->cong_link_cnt &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment