Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp50186pxu; Tue, 1 Dec 2020 06:00:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPBWZN81DgGFqaeSzivLHcYOTyxf31C4xTrtACht5fcN/aRLk9n882Eag3UF8/VJk1kAdF X-Received: by 2002:a17:906:7fcd:: with SMTP id r13mr3179720ejs.242.1606831230920; Tue, 01 Dec 2020 06:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606831230; cv=none; d=google.com; s=arc-20160816; b=fa+seNCx2e3wH3F7YfBbguTv391IulG6XI/GsA16VX2jvZLxe6ElZkZaQEKE7zZD2G nTi5MUuZDO00GTZXzJyf0oI2EYaUHh20VN0zCRsa+UMxJEdxMlXLl2dzoSuX2frmCTBd zWL7EMAlzVNyW0rq3jOVplclWK2GxlcAPjqQLHVqQ+K63cbgGzBuLBk3sJoN0Wyp+rni R6EcJw4DfD9rYI9uIRfxuR+/5oEVFDTE5dbfRr1X/aMnZeYXzs0ceOccm/wOECsKHSr6 anDYrLTRmxpAb2DZ7mJUqITab5/HdqelLR/5GSBqZu/8wL6vZkNl+AkiRaxuNcY/dqod PIgA== 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=KgRWIQbNQLm8Ff5c5L6EiZMdKffu8g9afmJYHUUtFFk=; b=jvySexajfXS3ZC3yLVnAPcTcfLl30/AzAZ4vxcEy+/8RxLWcVtQ5Ukh9xHRSo3v/3Y 5W1YblHP4bAWF91chfr6roLdI0TBrHKBX32D39LAKksiwMVlxWAepzOoMZtCscZcYIWd Db1SXAq2QTG8AZ1IAXZFf61d+5tcxb9vtM1Hty804cjSX2WueHhuGlamjgj5Mq/vPx7Z 7BugmHQ9qS6U8Wpk0qaJwcPzEuf3wfKJKPQvUwjK4Bf951OFMzgmB+0LR3ZY2xYzWEjb laxGycygJFKbCRzJkj814cbMWAIotYMuUCO1+DOqkqoCJC2j9GdfBJyKksinyJ/gjHf9 EILg== 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 c9si1172526edn.152.2020.12.01.06.00.07; Tue, 01 Dec 2020 06:00:30 -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 S2403803AbgLAN5x (ORCPT + 99 others); Tue, 1 Dec 2020 08:57:53 -0500 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:54015 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403792AbgLAN5w (ORCPT ); Tue, 1 Dec 2020 08:57:52 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R851e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0UHDFqZy_1606831019; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0UHDFqZy_1606831019) by smtp.aliyun-inc.com(127.0.0.1); Tue, 01 Dec 2020 21:57:00 +0800 From: Xuan Zhuo To: magnus.karlsson@intel.com, daniel@iogearbox.net Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , 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 V3 1/2] xsk: replace datagram_poll by sock_poll_wait Date: Tue, 1 Dec 2020 21:56:57 +0800 Message-Id: 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 Acked-by: Magnus Karlsson --- 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 b7b039b..9bbfd8a 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -471,11 +471,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