From patchwork Mon Jul 8 21:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 168688 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7662640ilk; Mon, 8 Jul 2019 14:34:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzadteb8zszeEqZ4fr06qHjlX6JEuAA+I+E10fzYL7bQfVr6Ub+ySGQLpZuZJpADtTbwsA4 X-Received: by 2002:a63:2b8e:: with SMTP id r136mr26063998pgr.216.1562621681294; Mon, 08 Jul 2019 14:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562621681; cv=none; d=google.com; s=arc-20160816; b=u5s8SP0sO5NcBse24OHuwrFYmdHIwaomn8TM35weMJ9OHQ51BGifZEzt0acw+R74fa h3z3CSLwblKnssidu7mREUFEYvwbw5ujy5GfRscK7uNmtjP06o52H+CwH+Yewp0ideyc a7Go8chA2/Xke2ewRdrW9LBvhxUm+WvngCjlZJrbsligT/HtYegBDT2iEaDXQXslZnyo z8vxK/tem5/3HGjSF26zu2jWlj+Kc75wQGa2ue1sXP5ssUjdosT0PoOhrApeJ2MX0mTF DJZHeIHvpXThHv8BPIXSsMBeoLAXERhIlJ/PjSS9GSciBQYhwg+HKdNwrtdj9luvpIOq bcAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/jUllDDZ3b7We2EmtZhggvnRSS7NBu/TTaz5tD6/PUc=; b=z0E8f+eyauG2EC94q5JvWRkVC4/DJfRdgOJnwafz50DWbAyJn+VUOsBThZS9E6YEZw uNo/r0h33YEStnfhvNg1glFgrfVBLB3JqWN/DSi90XUx0Vl8tCyjD++vN9bzfXsSSJgT f/hzJb0utphzVSjk04GelajTHGLoZLRlunU8NqllvmCAWcRY90G+PxRQqrWjOvYl2LXx KKYWEvkUHx2+AmVhkptRszhJokZFDFsSTpEAfZCBqHRbDN5ISMyHqnSWNIJic1IpV53U LITmPeVodoi+7gaHGZWCnvdLFFh6IRmyklq+0XthFnbojThlO7LO4CsJVZNRI4o7Ql/L 818Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T8pbps6C; 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 t19si20334731pfe.94.2019.07.08.14.34.41; Mon, 08 Jul 2019 14:34:41 -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=T8pbps6C; 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 S2404127AbfGHVei (ORCPT + 30 others); Mon, 8 Jul 2019 17:34:38 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38385 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729474AbfGHVei (ORCPT ); Mon, 8 Jul 2019 17:34:38 -0400 Received: by mail-lj1-f194.google.com with SMTP id r9so17431801ljg.5 for ; Mon, 08 Jul 2019 14:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/jUllDDZ3b7We2EmtZhggvnRSS7NBu/TTaz5tD6/PUc=; b=T8pbps6CRd0YYwTNpgOwCFTwOOC7K3bS+QLebfKLWanCnY22hZ2/Fzlhoz21wi9btl qeHAu27UExxlUyTgdNIVzORsRVkvD3PDhUCD7Z2LQRxS0R9ofH1QhUxQRs6Te1v6eGyZ LG1uW2nD+Ayo0T1reG8dFirp5xGI/MbJiyeG0tO5JKRgedhe7zP2ba2fOODu1NV0RFZq 0j5U87HXsJ1iFXKpPtbeK9jKHLRN2vUICPWz3OSNeWLZZ1zqhrrdqHV2PEiI7IG2DrQV 4/303OFQ65FkDNFHHdYHF81pcV4rhG06bASB5InaH3MQxmxx2WsbbMPYxSAN/o98cxgp NwQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/jUllDDZ3b7We2EmtZhggvnRSS7NBu/TTaz5tD6/PUc=; b=VNaSu5eU4fSZphLVT+6va6ur/1DzOgco5OCphIYjko75xDUoXQbcwG4ZbQgjIuQKyu yiSYOo2MGAGxPDF8CpnoqXIpUkCfDAXLgwtRYZdjxUQ8vtvPh+jlQx4opdnzD41IgEPP pRMAb9voMi74IfYFwLjMkZBRxebNBIYjiBVwk6TrUo637LNUFx0kD6FDCkT8nAl8zKV/ s/sqrhjcRGSdo6vBYZ/ql/BabEfUaE+STBeeti2Ncd0s/xvzkKerDiZs5xeauZpty+lJ FNlKtbHjHtI+FJx1hpDlPuod3nIhKFkjhh69x0d3cn1CjmNa0KVNmYFt4Bz3JblVTUfc 8D6Q== X-Gm-Message-State: APjAAAUhExtTjh0pCMSKwVVK5yrd2r+galudOImXXQo850AVa4qg4ciw Tyka7ZZ6mzvH5DB6gCW0lTl959CDukQ= X-Received: by 2002:a2e:1459:: with SMTP id 25mr8862117lju.153.1562621676013; Mon, 08 Jul 2019 14:34:36 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id o24sm3883096ljg.6.2019.07.08.14.34.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 14:34:35 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, hawk@kernel.org, davem@davemloft.net Cc: 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, Ivan Khoronzhuk Subject: [PATCH v9 net-next 0/5] net: ethernet: ti: cpsw: Add XDP support Date: Tue, 9 Jul 2019 00:34:27 +0300 Message-Id: <20190708213432.8525-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset adds XDP support for TI cpsw driver and base it on page_pool allocator. It was verified on af_xdp socket drop, af_xdp l2f, ebpf XDP_DROP, XDP_REDIRECT, XDP_PASS, XDP_TX. It was verified with following configs enabled: CONFIG_JIT=y CONFIG_BPFILTER=y CONFIG_BPF_SYSCALL=y CONFIG_XDP_SOCKETS=y CONFIG_BPF_EVENTS=y CONFIG_HAVE_EBPF_JIT=y CONFIG_BPF_JIT=y CONFIG_CGROUP_BPF=y Link on previous v7: https://lkml.org/lkml/2019/7/4/715 Also regular tests with iperf2 were done in order to verify impact on regular netstack performance, compared with base commit: https://pastebin.com/JSMT0iZ4 v8..v9: - fix warnings on arm64 caused by typos in type casting v7..v8: - corrected dma calculation based on headroom instead of hard start - minor comment changes v6..v7: - rolled back to v4 solution but with small modification - picked up patch: https://www.spinics.net/lists/netdev/msg583145.html - added changes related to netsec fix and cpsw v5..v6: - do changes that is rx_dev while redirect/flush cycle is kept the same - dropped net: ethernet: ti: davinci_cpdma: return handler status - other changes desc in patches v4..v5: - added two plreliminary patches: net: ethernet: ti: davinci_cpdma: allow desc split while down net: ethernet: ti: cpsw_ethtool: allow res split while down - added xdp alocator refcnt on xdp level, avoiding page pool refcnt - moved flush status as separate argument for cpdma_chan_process - reworked cpsw code according to last changes to allocator - added missed statistic counter v3..v4: - added page pool user counter - use same pool for ndevs in dual mac - restructured page pool create/destroy according to the last changes in API v2..v3: - each rxq and ndev has its own page pool v1..v2: - combined xdp_xmit functions - used page allocation w/o refcnt juggle - unmapped page for skb netstack - moved rxq/page pool allocation to open/close pair - added several preliminary patches: net: page_pool: add helper function to retrieve dma addresses net: page_pool: add helper function to unmap dma addresses net: ethernet: ti: cpsw: use cpsw as drv data net: ethernet: ti: cpsw_ethtool: simplify slave loops Ivan Khoronzhuk (5): net: core: page_pool: add user refcnt and reintroduce page_pool_destroy net: ethernet: ti: davinci_cpdma: add dma mapped submit net: ethernet: ti: davinci_cpdma: allow desc split while down net: ethernet: ti: cpsw_ethtool: allow res split while down net: ethernet: ti: cpsw: add XDP support .../net/ethernet/mellanox/mlx5/core/en_main.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 8 +- drivers/net/ethernet/ti/Kconfig | 1 + drivers/net/ethernet/ti/cpsw.c | 502 ++++++++++++++++-- drivers/net/ethernet/ti/cpsw_ethtool.c | 57 +- drivers/net/ethernet/ti/cpsw_priv.h | 7 + drivers/net/ethernet/ti/davinci_cpdma.c | 106 +++- drivers/net/ethernet/ti/davinci_cpdma.h | 7 +- include/net/page_pool.h | 25 + net/core/page_pool.c | 8 + net/core/xdp.c | 3 + 11 files changed, 640 insertions(+), 88 deletions(-) -- 2.17.1