Received: by 10.192.165.148 with SMTP id m20csp768294imm; Fri, 27 Apr 2018 07:14:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr57xNAyNI4/Q0qD71/M4EeOIu7eOGbh1qsshBOUCF9Durcc4St4VVQV9t6Ep7pzF3rWlVb X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr2486945plg.195.1524838451375; Fri, 27 Apr 2018 07:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838451; cv=none; d=google.com; s=arc-20160816; b=W8LE+43QaIVsyenxcN+OE6sgGn+ZFkD7juenwAvuIUSrziQcyt7IPF6wxQZFGXotRP L/Kwt1DVgaVegyP8XLqbYU7D5uk/V1mnEfNUpGzeF6JCzZGIAwZuh+QmPnWihCsqJOmL D8JIyEgQ7p9fHOWXDhDqnrJtT5TWakOv9p4XgUrxju7U7BAopen5dKGI/bPKFAeY/nOO r0yJYRHn+I/UKCPfKFFavw1ZZzQg319kQaUOf9CJFjSWrMWZCCCRyhugFuiRA+scd4ID aqfBbtOGkDq78eeR08e3FAxBs1GR6qdKdEwNXyZ1RAs3Y0+ocRIec7FQBLRedYgY6KOM 8DRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=1ablwz0uUQBs35rspVMYaLhOP3Nmni58OEpmelRf8Y8=; b=VGbSk/IlG7v72agoe+o0ZogTK4oCgZvXszpZWPtOGGLg+pQhxumcN6T/RnO8rY9O5h lLkpOIuXKUREmjVK7Y7MH/kTOQDHV/DLZwMzAGi+PHffuQmlSAjMnkgAlo0M24SKZwbC 8fclIIb5nJ2n1rroP31OuBxwGqaF8iEso8m6JcPHbe2KVxEaArX5mZ8xamk8lQhSWEgi yM8BYm+6v9fZkcKj3w0LuJp45DJlmkCKIreU397UkJoTBOapQkCgvHtwN9j5OkwB2bZn cYBdOq7mdsYuPlTpUBLasTRQc+33KtUec5aYmbUNlyCyVF0CNYyScH3ONnq0HKauNBAP dzIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si1283783pgu.212.2018.04.27.07.13.57; Fri, 27 Apr 2018 07:14:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934559AbeD0OLp (ORCPT + 99 others); Fri, 27 Apr 2018 10:11:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:56392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934628AbeD0OLj (ORCPT ); Fri, 27 Apr 2018 10:11:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72D0721895; Fri, 27 Apr 2018 14:11:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72D0721895 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kimitoshi Takahashi , Daniel Borkmann , Jason Wang , "David S. Miller" Subject: [PATCH 4.16 53/81] virtio-net: add missing virtqueue kick when flushing packets Date: Fri, 27 Apr 2018 15:58:55 +0200 Message-Id: <20180427135746.321343844@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135743.216853156@linuxfoundation.org> References: <20180427135743.216853156@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang [ Upstream commit 9267c430c6b6f4c0120e3c6bb847313d633f02a6 ] We tends to batch submitting packets during XDP_TX. This requires to kick virtqueue after a batch, we tried to do it through xdp_do_flush_map() which only makes sense for devmap not XDP_TX. So explicitly kick the virtqueue in this case. Reported-by: Kimitoshi Takahashi Tested-by: Kimitoshi Takahashi Cc: Daniel Borkmann Fixes: 186b3c998c50 ("virtio-net: support XDP_REDIRECT") Signed-off-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/virtio_net.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1269,7 +1269,9 @@ static int virtnet_poll(struct napi_stru { struct receive_queue *rq = container_of(napi, struct receive_queue, napi); - unsigned int received; + struct virtnet_info *vi = rq->vq->vdev->priv; + struct send_queue *sq; + unsigned int received, qp; bool xdp_xmit = false; virtnet_poll_cleantx(rq); @@ -1280,8 +1282,13 @@ static int virtnet_poll(struct napi_stru if (received < budget) virtqueue_napi_complete(napi, rq->vq, received); - if (xdp_xmit) + if (xdp_xmit) { + qp = vi->curr_queue_pairs - vi->xdp_queue_pairs + + smp_processor_id(); + sq = &vi->sq[qp]; + virtqueue_kick(sq->vq); xdp_do_flush_map(); + } return received; }