Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp538086ybi; Wed, 3 Jul 2019 00:39:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzywAWdwLsgspUKSdFFCFDX6tB+AebKeFlzQORwE6L3diqJCcZlfT9jGKYkYP8Op4Oj3G/w X-Received: by 2002:a17:902:a03:: with SMTP id 3mr40186197plo.302.1562139589080; Wed, 03 Jul 2019 00:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562139589; cv=none; d=google.com; s=arc-20160816; b=Hwup+b/GMFt23makatW/n/EyX6kOqeC9dz0iF9Pou+NZyOh4q6h62VbD3J+AXz5yF9 7gdIGrZure5O/GvU2NEliZ86BUr7NckKJWfyF5PJCdksrQ2uv0qtRiPPut434ypf9lRX F66HWK7LLj5DZJcJ3BK5SWhzgYEb8pNpatAkrTC4xcYCTm6cvNM+mDwogRsnyOVb5uZz Psh1PkiWnHSPrt522OAsKLqOpmPmN1gidQix8aMDDc18js8TNIp65zeVArYfQXcgXiLh Kx9N3qr3xPKpdHe42Hq2csmEnM/vfxKHTanRyYVLindVyIgKu7RHoDQMDOj1UgGoGIL0 UccQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=2Wp52PBXKgmN1eJSawD7UHQEQNJnFNq41D1U5ZiE5Bo=; b=SFsiu7llKd/KpEa5KTkvrUuP0HVWhhn4YhgrbCjzGhIsvTr+vLZ+76CxWe9PyUctjE 5SAUYse0VvjHkIt1/XTYoSgll8JSz7Lq5ZGpIWzB/os9o8nmhVKDzTWvfD40X3BpXGzn HCDgc89I7nNu1DZVI4alwSzYSPZfaSQdzDybcegsfafeXZerxT2jaVjy+lM2iyRNYSPN XWI+khll0AOVsgZbL5QLm1VgsoNU+tdObxAMdSRyRnrTu/BeFu74u9m+OEjl/RjQcvul +CVdT3SMlnAQXKalcWdKacIMWO47Ts00SDgJKJ9SatX/94v3MT7Bs9Vhi0536TGATb8D Y6jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xh1pMxs4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j95si1565996plb.349.2019.07.03.00.39.33; Wed, 03 Jul 2019 00:39: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; dkim=pass header.i=@linaro.org header.s=google header.b=Xh1pMxs4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbfGCHjD (ORCPT + 99 others); Wed, 3 Jul 2019 03:39:03 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39164 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727008AbfGCHjD (ORCPT ); Wed, 3 Jul 2019 03:39:03 -0400 Received: by mail-lf1-f67.google.com with SMTP id p24so1019909lfo.6 for ; Wed, 03 Jul 2019 00:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2Wp52PBXKgmN1eJSawD7UHQEQNJnFNq41D1U5ZiE5Bo=; b=Xh1pMxs44/cvgbIPdlvqWFnxIJ8en8yjJHAJY6KuWeq1CEy3k59s8hTBuaV/uvBt3m ycpPeoODSURlw/yRgrS9/Ix2TTPYntmr15kL0HXjEBAHulbR0XvdXSwImep3KZ0jLT6X xTkSmgo0jYD7TQosCD70j71q3pejld6xQVHya/IukRJm4km2mbLSsSnNzkY9CLXVAbZ5 0YS8qFpA0RjSPWjfTu8/nVmGbQ1PtI8oOMysnJSZb2Vdg3P95jdot7hY+X1M9Hs47pr0 F2PcCz6fK0JvmGwcEVYXEgRU5iqE+h0xid1o2dDSun7EagnjIf1nf0tmqTHNq8QWjhDP 3SuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=2Wp52PBXKgmN1eJSawD7UHQEQNJnFNq41D1U5ZiE5Bo=; b=mYNIsd3jfOBcQBlHRQlZpiwmKVL4Y4xC/MD6mcyGyDI3V+DjC8oLq9hzDeHL5cVF8T ywyGYLoEwWubVB96Cqpz34LdkFzP/zAuSS/mUSgT+eKVC97Km4DufXj61Ug1aBXFjWca ZLCTYDvWmHn+IrNv8nqB+DW9sx0oMvStcHiY3JVaiWWFaIfyYMYGtd71USbeMkdUkKzg UkFMjkucdQOgQwLp1gO84HM1MSTFHnoH7bORenh0Z/RvTBZRVXNV1ZfmT2Nh5wITOA2k MiG2vR2YSpqK0ry7rRWcdvRgNHQ/Zd2HUlBOKsG8OTJ6BfK0Ma5QA6sNUnwt984MrxBk 8jFw== X-Gm-Message-State: APjAAAX/J3NektIB4VDae4EsTuM77ZTdHtyoAZ8dQE0eBUbNK80TIG4Q CKvQLYCp/5p0hpEKPp6g+dFC9A== X-Received: by 2002:ac2:42ca:: with SMTP id n10mr5174666lfl.121.1562139540856; Wed, 03 Jul 2019 00:39:00 -0700 (PDT) Received: from khorivan (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id h129sm263683lfd.74.2019.07.03.00.38.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Jul 2019 00:39:00 -0700 (PDT) Date: Wed, 3 Jul 2019 10:38:58 +0300 From: Ivan Khoronzhuk To: Jesper Dangaard Brouer 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 Subject: Re: [PATCH v5 net-next 6/6] net: ethernet: ti: cpsw: add XDP support Message-ID: <20190703073857.GA2927@khorivan> Mail-Followup-To: Jesper Dangaard Brouer , 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 References: <20190630172348.5692-1-ivan.khoronzhuk@linaro.org> <20190630172348.5692-7-ivan.khoronzhuk@linaro.org> <20190703092603.66f36914@carbon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190703092603.66f36914@carbon> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 03, 2019 at 09:26:03AM +0200, Jesper Dangaard Brouer wrote: > >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. ). I said, I moved to be per device in rx_handler. It violates nothing. > >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 Jesper, Seems I said that I moved it to flush, that does dev->netdev_ops->ndo_xdp_xmit(), to rx_handler, so that it's done per device, so device is knows per each flush. In the code, I hope everyone can see ..., after each flush dev_rx is cleared to 0. So no any impact on it. As for me, it's very not clear and strange decision. -- Regards, Ivan Khoronzhuk