Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp152453pxb; Wed, 18 Nov 2020 00:26:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpHbNBPKPZRmYSTrdfpDYIFuQnHaw45rIDNiMcbK80smDfL89Ff1+x4IrkynJMH6Vz2J8d X-Received: by 2002:a50:f40a:: with SMTP id r10mr24743230edm.229.1605688015240; Wed, 18 Nov 2020 00:26:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605688015; cv=none; d=google.com; s=arc-20160816; b=udsFTbTHNA9t1xWVcAR+0isr89AOlpru7HfW/RD0lz2WpLRFeCXaRA1Q+iCVnHtyA3 4h+vor6yL8O1k0p2V8UFaUYHfl7S+h1247YMJJ8MyHLEJF1EI+Fv1ch5ttKJZoUPe5qp sBI1QC6d5r4IFrYjm7XACeuBNGjtZ9v+QB1DJV+Vz99kHl9IVF8zfAxpSxSdkT+E4UKH wvptLgYWcA66OVgyo0K35wt909f/8+XwLtHqVxofGSkmiSvUTsX+nfQ+1+7P0y59FJpb Mg6cUF6mnzWk8xvmayXjyDTAyesooimgAbtSD7pZ8387ZurjkGl3B2JHLmW+JB+tyWLb HdlQ== 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=3loalupjav0QgPMaSv5qtEQUMnS5GCq+YgAgkCc1yKk=; b=u12lRSD6KPoOOC2XCTIPjV1asKF5YzMfM8g+ovjGozD0z/6XHjctoZ1/Bi4me9UA09 rhi6K2zj8nPbTE9QEoO5NooXRExO6QCqlCvyc5GHOk9HbBCnBC6Z0rxmmZyoQLSEStgz hdx2xi/SdugwwRlNEYjJd7Fu6VyfUC0lp/6Zr4AvWvcmJyRzYHg5fsEjkmq921Vq2Qk7 DXYZuSGyW02VAQNgc1H5qdmRPdyoLOGRkIDjTypJUZtgrkyWCn0OlT3fbXPrudXqDyZ3 nLb6/6NnezJfQk4Q6EHfJ7BA9MXcLH3KjxOBM2ZWgQvsniuF26NgZmKBCpQ01OSiVLt5 WaDA== 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 a2si14834906eju.633.2020.11.18.00.26.32; Wed, 18 Nov 2020 00:26:55 -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 S1727168AbgKRIZS (ORCPT + 99 others); Wed, 18 Nov 2020 03:25:18 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:60180 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbgKRIZQ (ORCPT ); Wed, 18 Nov 2020 03:25:16 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R761e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0UFn3IGa_1605687911; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0UFn3IGa_1605687911) by smtp.aliyun-inc.com(127.0.0.1); Wed, 18 Nov 2020 16:25:11 +0800 From: Xuan Zhuo To: bjorn.topel@intel.com Cc: Magnus Karlsson , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait Date: Wed, 18 Nov 2020 16:25:08 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: <3306b4d8-8689-b0e7-3f6d-c3ad873b7093@intel.com> 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 cfbec39..7f0353e 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -477,11 +477,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