RE: [Patch bpf v2 7/7] skmsg: increase sk->sk_drops when dropping packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cong Wang wrote:
> From: Cong Wang <cong.wang@xxxxxxxxxxxxx>
> 
> It is hard to observe packet drops without increase relevant
> drop counters, here we should increase sk->sk_drops which is
> a protocol-independent counter. Fortunately psock is always
> assocaited with a struct sock, we can just use psock->sk.
> 
> Cc: John Fastabend <john.fastabend@xxxxxxxxx>
> Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
> Cc: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
> Cc: Lorenz Bauer <lmb@xxxxxxxxxxxxxx>
> Signed-off-by: Cong Wang <cong.wang@xxxxxxxxxxxxx>

[...]

>  static void sk_psock_backlog(struct work_struct *work)
>  {
>  	struct sk_psock *psock = container_of(work, struct sk_psock, work);
> @@ -617,7 +623,7 @@ static void sk_psock_backlog(struct work_struct *work)
>  				/* Hard errors break pipe and stop xmit. */
>  				sk_psock_report_error(psock, ret ? -ret : EPIPE);
>  				sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED);
> -				kfree_skb(skb);
> +				sock_drop(psock->sk, skb);
>  				goto end;
>  			}
>  			off += ret;
> @@ -625,7 +631,7 @@ static void sk_psock_backlog(struct work_struct *work)
>  		} while (len);
>  
>  		if (!ingress)
> -			kfree_skb(skb);
> +			sock_drop(psock->sk, skb);

This is not a dropped skb this was sent via skb_send_sock().

The rest LGTM thanks.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux