Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp525012ybi; Wed, 3 Jul 2019 00:26:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDkYRuBSsjH3sWTWpk+BHNDd44kfu5UmpzsrllJHs4p4Gs0MOARVhVg0ZgiN7j6Pw/ex9D X-Received: by 2002:a63:fd0d:: with SMTP id d13mr36559370pgh.423.1562138809369; Wed, 03 Jul 2019 00:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562138809; cv=none; d=google.com; s=arc-20160816; b=WFWKAR9FD2FvN/NK9pyXseBZ+MZH7XMYIZmi1FnXQaCSMDyyKEGRg1SIy0gJ87l3Fr mJ0YRei09X4AQPd1/e7UaQ7WBhl3UTDnXaxlOJ9uxdDua7oqAvIpkqwNbAQfc1Gagct0 j/1l4C2VcfYSjA3mY+11uOLWkAFzVOYdA1mEbLbdnsXPpuwYUDnKRQL2FBp6Cmv8cnnp jcfklv5iLnQfBmqHNDAyy9qbFtHqoE0kRXg+aBcAo1urH6ecU+xRJMPDsYjAbQ+OL7dG InuzdWvw0ATP2GaTZ0TEu/3pwrFt0tG9Vm0XvPAOB5VQN4JMtu4nv3nlevSV1GAiLsf+ t9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=FHlVfOrj8xjMxFdVLjSiOWGTGvQuUDhXxtCF6yKu7Tg=; b=a+8TrUi48j+QZeLEslEacaHfkLAK3nHXsfSCWCnR1J2J77Owyt21zFviKeEsgRFAXZ HfNkKJ3+UIgdLQu44qB7ITpq6OuJju2WIWH2gJcQfdZfcRxuyeBErNgDThCRAyJC9+dG rfGGpIkDOTBQOMovoqjCNpscRI/Ea+QEj1X5a8pKxEhqEkRL3juDl4uhOIsMDWPvJEnM NEoSzw7iBue5xYj5VvjGMGg3wsOOZW3nctAGlrOuPoFBy9uPappnSz2JhHH6hTDT9pPt weuI0Cd3DuxhcDH/tGYRChL0ffh7QiLJlgkqCdXndykkuEbK16Z9fp/Nz4mRCBRNllAR 1Vtw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p35si1723580pgl.106.2019.07.03.00.26.33; Wed, 03 Jul 2019 00:26:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbfGCH0N (ORCPT + 99 others); Wed, 3 Jul 2019 03:26:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14659 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbfGCH0N (ORCPT ); Wed, 3 Jul 2019 03:26:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2A123083391; Wed, 3 Jul 2019 07:26:12 +0000 (UTC) Received: from carbon (ovpn-200-45.brq.redhat.com [10.40.200.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CCF680F70; Wed, 3 Jul 2019 07:26:05 +0000 (UTC) Date: Wed, 3 Jul 2019 09:26:03 +0200 From: Jesper Dangaard Brouer To: Ivan Khoronzhuk Cc: grygorii.strashko@ti.com, hawk@kernel.org, davem@davemloft.net, ast@kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, xdp-newbies@vger.kernel.org, ilias.apalodimas@linaro.org, netdev@vger.kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, john.fastabend@gmail.com, brouer@redhat.com Subject: Re: [PATCH v5 net-next 6/6] net: ethernet: ti: cpsw: add XDP support Message-ID: <20190703092603.66f36914@carbon> In-Reply-To: <20190630172348.5692-7-ivan.khoronzhuk@linaro.org> References: <20190630172348.5692-1-ivan.khoronzhuk@linaro.org> <20190630172348.5692-7-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 03 Jul 2019 07:26:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 30 Jun 2019 20:23:48 +0300 Ivan Khoronzhuk wrote: > Add XDP support based on rx page_pool allocator, one frame per page. > Page pool allocator is used with assumption that only one rx_handler > is running simultaneously. DMA map/unmap is reused from page pool > despite there is no need to map whole page. > > Due to specific of cpsw, the same TX/RX handler can be used by 2 > network devices, so special fields in buffer are added to identify > an interface the frame is destined to. Thus XDP works for both > interfaces, that allows to test xdp redirect between two interfaces > easily. Aslo, each rx queue have own page pools, but common for both > netdevs. Looking at the details what happen when a single RX-queue can receive into multiple net_device'es. I realize that this driver will violate/kill some of the "hidden"/implicit RX-bulking that the XDP_REDIRECT code depend on for performance. Specifically, it violate this assumption: https://github.com/torvalds/linux/blob/v5.2-rc7/kernel/bpf/devmap.c#L324-L329 /* Ingress dev_rx will be the same for all xdp_frame's in * bulk_queue, because bq stored per-CPU and must be flushed * from net_device drivers NAPI func end. */ if (!bq->dev_rx) bq->dev_rx = dev_rx; This drivers "NAPI func end", can have received into multiple net_devices, before it's NAPI cycle ends. Thus, violating this code assumption. Knowing all xdp_frame's in the bulk queue is from the same net_device, can be used to further optimize XDP. E.g. the dev->netdev_ops->ndo_xdp_xmit() call don't take fully advantage of this, yet. If we merge this driver, it will block optimizations in this area. NACK -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer