From patchwork Thu Jul 4 23:14:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 168496 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2795352ilk; Thu, 4 Jul 2019 16:14:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSGj0u8SXwwcIwJPe5szAGvF5bSWiVTNZOqyQlt3m+GfP5DpCYd2h077GULw05IMpe31Xl X-Received: by 2002:a63:d748:: with SMTP id w8mr890189pgi.157.1562282069253; Thu, 04 Jul 2019 16:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562282069; cv=none; d=google.com; s=arc-20160816; b=SIljLvZhSS4Enr/hpESprZXxkptLfHpUvBxVWo5Jq5ZpaPvnYMLexGXl9MiEu7LWJJ 5wcgWgb8UHhCNAr3wQLgJt0g7Bm/aSMO5FmT4O5pUrZ+CYbSqTawGzrCWyt/cz1Eauxz ykR1Irc+xFhalU0V3iASqgRrEes/qa+iWJxj4lJRu9ZvHVlWrkj/vnHbLyPLTihJ+kXI 1G91/Qux14GP+MLyJiRjcQfDOPb3+1Mi0vUdw2gCUnKwrNP2X1FtFKRSQBjt0DKKR+iZ Cx4jLQ/loGYnP3bpdFjKg7/NsOQ+89zFnm53UZQehFlelVgbtUHvHyD2Fh72wPY2+4FC SZWg== 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=bVDhPr1NYeKDnrMdcMHlybkPxVb9bTLFPQt8UIwuo9g=; b=YPlrNCb2dZ9yxfdjEDNq9FhKanVJUTa2oIjT18Y7bAba+8L2wxHLt62hRDMMo/9C7m Dbja3Xrb/zeYpVz7ro6kH2Q9dbrav5jCOpXtBGEHaVZorCbait/i3WdlY7WCM+5UYsJh mvD+Z/UsYC5qQ1xAFQxaJtvYwWpal3o/68y0MSFV4AtZUJt/OXEIInvQxMkTEishHRzq kKm2dMmqh/rE+VDopQCahcPdqSFK/e60mC3gqbWVIUZsMXU5OfJ0xBTgRm+VJuGfZ/Oj sCzUIJ+dLcwk+IzTnlGBsGBJqGBrtFhMxEy54SXU/GSn+vCP2GneOTz9PALqhhTyJ1h6 Mfjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y2oAh8lv; 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 a187si6843970pge.269.2019.07.04.16.14.28; Thu, 04 Jul 2019 16:14:29 -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=Y2oAh8lv; 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 S1727553AbfGDXO0 (ORCPT + 30 others); Thu, 4 Jul 2019 19:14:26 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45045 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727379AbfGDXO0 (ORCPT ); Thu, 4 Jul 2019 19:14:26 -0400 Received: by mail-lj1-f195.google.com with SMTP id k18so7421910ljc.11 for ; Thu, 04 Jul 2019 16:14:25 -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=bVDhPr1NYeKDnrMdcMHlybkPxVb9bTLFPQt8UIwuo9g=; b=Y2oAh8lvwJqXl1+6yeHQ/iXA9z4VaR8LEnUnmIAOpwP5SNCVLDSMIzrsWl/abPO2X4 G9Sh4lSvLw0dpYZ68GsTpzVFmuij/tHS0rMJAo6G6hn7tbXDsjTzFgQ9SLGoyqvYs8tN onSKcrgq6/GjjogzlnAKi9a5wg2orPWPCKR91cft2pADiG9rqhWV4Nm7pyQDFLYCNvFo okyPW7k+sAB7pzXkyCVpMfeyj29nxKbyGDE1m6M/3jrUyHlFlNJ/m1WaLdTVYUopk5ox lsO9gsZZJMbAUxt4VPy9M+YKdPTUF9n8vXCP644dzTOSMya+t7a0m0j4MDBy/uFck7II NzEA== 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=bVDhPr1NYeKDnrMdcMHlybkPxVb9bTLFPQt8UIwuo9g=; b=K4iIdsGtH1QNMVBJLQeX5kWSpjzy2NPjkisMnscYBsiDwN0wd4GD3hEcPLQYEe9mMu zNcOo/5lx1+1IQLJ66TRrYv0vE9dKR5z6zoICKojo9/668YEvlrEBfDNooGD6XA4Rei6 r3xarJnzeQNnXy4WjKcgi0AN65WFgFO4wxaSaex8+wgZNixLGMoeg92+MYSLN+dRwvDY nlb/EMTxyVP9nenBq0Zy7X9PHwIzJBU3+ExJJ5HcpyAHEHyew7L4PWmjqtHeChO4if/U GNYnS7c7SYY8Qbub8xQI0sTE/X3l+BXFXHiu11uFe+jtHCDH//k3W58+LXsV7SleIwu4 nuVA== X-Gm-Message-State: APjAAAWih5vjtNTIewy5sDRFvwAlkZKepRpK8ZkpzIWVu2h3zteOBXAI s/1nWlvKBcUCspty5piMMEdaWg== X-Received: by 2002:a2e:864d:: with SMTP id i13mr302944ljj.92.1562282064462; Thu, 04 Jul 2019 16:14:24 -0700 (PDT) Received: from localhost.localdomain ([46.211.39.135]) by smtp.gmail.com with ESMTPSA id q6sm1407269lji.70.2019.07.04.16.14.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 04 Jul 2019 16:14:23 -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 v7 net-next 0/5] net: ethernet: ti: cpsw: Add XDP support Date: Fri, 5 Jul 2019 02:14:01 +0300 Message-Id: <20190704231406.27083-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 v6: https://lkml.org/lkml/2019/7/3/243 Also regular tests with iperf2 were done in order to verify impact on regular netstack performance, compared with base commit: https://pastebin.com/JSMT0iZ4 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 Acked-by: Jesper Dangaard Brouer Acked-by: Jesper Dangaard Brouer Reviewed-by: Saeed Mahameed