Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp159613pxu; Tue, 24 Nov 2020 22:53:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF6R1g3ZrvZB7C5MU+pDF1MIhvXhyP1Z3yxEF07gpeqTU0cn1ybPtBplWNfIoMhk2aiFDs X-Received: by 2002:a17:906:4982:: with SMTP id p2mr1933421eju.416.1606287180612; Tue, 24 Nov 2020 22:53:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606287180; cv=none; d=google.com; s=arc-20160816; b=08FRfwEHdc10BJoumcWW33QGIOKDd1y/L7mYKFWP4fuWD7jefBHW+Tf8RRBMjYZiAv nm97I2ZmuDohGGoNY3Fs/ZlQOYK/vw28wUKFAZbZSQ7Lr9YihAqGqdL1t1l1BNeIJ4JQ oIpqK9qBBaTcXpW4/yyHbFT9nbbOOI/HtgdggQomnhGgmiP+1jDMPYxqDcj6pX/45vpt GNgeUoH7KDdw6hkrKoJmrb5xK1yyjreXO7TusVcuzPLLd5k2FDAookhbFWLJKaNEpoR8 UODCgPLGz7ILn8N+STvKrrH8bh/iJEEl0/POlZ/8bL9OS5527VEDhFZzEDOmFM5QcF1H Mi8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=yGIKQM0C1SxMX2iSKqYlgulZGiu6h05XXZc0ULlpuDA=; b=ShOjQ98/DvFfkyeYSnhDQvwWta5OoVgZSjEWyifbhwAPvIhh4ZV85SPWoTSjH3pVJG 7ythJYu1nD29z9WHOHbRBt0fnNAC/qnE0Jq8dY/PlFedNEAO/pIn0FnEDF+0sfLCnX7R 6bOXzFwsA/7LUqVQx9s92rq26XbyOQLQ1Ml/AyFA3PjFO27VGPcQmIzbD5R8k+QVIzxg sHpoZst8SKOK5kteJioKIFK8cJCmZHBeXM6GPkMrHo/hh8o65mnkePd+on9iGfT6r62/ 69vb0TtAGc3Cg2KfHWQA+264+XU/juK2sg2jRtfte4UxEEyG1nk+jNkpU3iOlo7tj0fy UbrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si679465edr.154.2020.11.24.22.52.37; Tue, 24 Nov 2020 22:53:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbgKYGtC (ORCPT + 99 others); Wed, 25 Nov 2020 01:49:02 -0500 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:43647 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbgKYGtC (ORCPT ); Wed, 25 Nov 2020 01:49:02 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R821e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0UGUMiM2_1606286938; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0UGUMiM2_1606286938) by smtp.aliyun-inc.com(127.0.0.1); Wed, 25 Nov 2020 14:48:59 +0800 From: Xuan Zhuo To: magnus.karlsson@gmail.com Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , KP Singh , netdev@vger.kernel.org (open list:XDP SOCKETS (AF_XDP)), bpf@vger.kernel.org (open list:XDP SOCKETS (AF_XDP)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH bpf v2 1/2] xsk: replace datagram_poll by sock_poll_wait Date: Wed, 25 Nov 2020 14:48:56 +0800 Message-Id: <01f59423cad1b634fe704fe238a0038fd74df3ba.1606285978.git.xuanzhuo@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) based on the traditional socket information (eg: sk_wmem_alloc), but this does not apply to xsk. So this patch uses sock_poll_wait instead of datagram_poll, and the mask is calculated by xsk_poll. Signed-off-by: Xuan Zhuo --- net/xdp/xsk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index b014197..0df8651 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -534,11 +534,13 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) static __poll_t xsk_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait) { - __poll_t mask = datagram_poll(file, sock, wait); + __poll_t mask = 0; struct sock *sk = sock->sk; struct xdp_sock *xs = xdp_sk(sk); struct xsk_buff_pool *pool; + sock_poll_wait(file, sock, wait); + if (unlikely(!xsk_is_bound(xs))) return mask; -- 1.8.3.1