From patchwork Tue Feb 26 18:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1048505 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ILrAno4m"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44877r6WNQz9s71 for ; Wed, 27 Feb 2019 05:46:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729168AbfBZSqa (ORCPT ); Tue, 26 Feb 2019 13:46:30 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35902 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfBZSqa (ORCPT ); Tue, 26 Feb 2019 13:46:30 -0500 Received: by mail-lj1-f196.google.com with SMTP id v10so11734942lji.3 for ; Tue, 26 Feb 2019 10:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ehPWfRVfK1p99dYox//webXUAklCK+7Ufmh1dOaEe+Y=; b=ILrAno4mM9tahTLrOcBdadOTIiUxI4PHdflVrHrcckIYitpumxGkRp0rBgo61bX34f RfpfYJ4MiLi+xU4iLOcHDcupGxq6AWsYNoBDZwbiZteNManCzuhujW0+na8YZhb2bUZT wF+bfMzHbSDPVez+BsPPK+f/OdUfSZOwdsrY6d2gQnrAzAmQU9/6+iWJN1bQfU3QyOtc X9dwoVWMzgy503gkboTMMFaX4Hh3bl9fABSvVlMJz7/VAIF04AIYSr1yeVsg4kSkmH19 5rXh7J32qtAmkPtRyiNxBLVX7ORTwSSzUt0vZKO7wBVJaUljc7QIUgJ7bQ4bQ2vgCmKg H0ZA== 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=ehPWfRVfK1p99dYox//webXUAklCK+7Ufmh1dOaEe+Y=; b=QDbKV+bZBWKRQu1pcxbDIrN12hgMvryb9T6zSK9Q4vruD57gnvAbWprQkRZg1mkt80 yj5SG8d5GH5WOkN6lobfpaPcJH+nUVNR/5W28qXQ9puLS+tNONM8s5PWstK288qv5LOK zzv+qfbKZXoCeOreXaUCGb6gc8XHMTCylw5qAt+9xTYtmfpcjxq4D+KLYqzLzeVwFRjN p3Z2F26Q6hCLfEnvIYNyVY1OXZ6yXWYiMEqqFSwlHXMlOFhNshLLLMeq5oEPbnUoVwHt dsx/iNsMCmrguLDWR4gwiiyB6eFyOvUt1UTDa8znk8JJGy2Yqh24qS+82Kq4b5QSNdLm oB3A== X-Gm-Message-State: AHQUAubiehnzYD+czwikcG8X/GIZtEq9jRSk8ULnv7cjTdiRQa0OcmjW NcBPZLDCaIJawhd1xeXvpC1thA== X-Google-Smtp-Source: AHgI3Ia4lzOchB5cU6yO1VIBEX1Fqvjnp3CCQGJTZd2DwkO1jDotcuhXPbn9bFWtKH+AdsucFMOQjw== X-Received: by 2002:a2e:9d83:: with SMTP id c3mr14138162ljj.171.1551206788079; Tue, 26 Feb 2019 10:46:28 -0800 (PST) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id s129sm3015190lja.49.2019.02.26.10.46.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 10:46:27 -0800 (PST) From: Ivan Khoronzhuk To: davem@davemloft.net, grygorii.strashko@ti.com, f.fainelli@gmail.com Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@mellanox.com, ilias.apalodimas@linaro.org, Ivan Khoronzhuk Subject: [PATCH net-next 0/6] net: add individual virtual device filtering Date: Tue, 26 Feb 2019 20:45:50 +0200 Message-Id: <20190226184556.16082-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org One of the reasons of this proposition is safety and performance - host should not receive traffic which is not designated for it. Some network devices can hold separate address tables for vlans and real device, but for some reason there is no possibility to apply it with generic net addressing scheme easily. At this moment the fastest solution is to add mcast/ucast entries for every created vlan including real device. But it not only consumes forwarding table but also adds holes in the filtering and thus wastes cpus cycles. This patchseries tries to correct core to assign mcast and ucast addresses only for vlans that really require it and as result an end driver can exclusively and simply set its rx filters. As an example it's implemented on cpsw TI driver, but generic changes provided by this series can be reused by other ethernet drivers having similar rx filter address possibilities. An address+vid is considered as separate address. The reserved device address length is 32 Bytes, for ethernet devices it's additional opportunity to pass auxiliary address info, like virtual ID identifying a device the address belongs to. This series makes it possible at least for ETH_P_8021Q. Thus end real device can setup separate tables for virtual devices just retrieving VID from the address. A device address space can maintain addresses and references on them separately for each virtual device if it needs so, or only addresses for real device (and all its vlans) it holds usually. A vlan device can be in any place of device chain upper real device, say smth like rdevice/bonding/vlan or even rdevice/macvlan/vlan. This series is verified on TI am572x EVM that can hold separate tables for vlans. Potentially it can be easily extended to netcp driver for keystone 2 boards (including k2g) and also new am6 chipsets. As a simple test case, different combinations of vlan+macvlan, macvlan+vlan were used and tested as with unicast as multicast addresses. Based on net-next/master It's continuation of RFC: [RFC PATCH net-next 0/5] net: allow hw addresses for virtual device https://lkml.org/lkml/2018/12/3/817 Ivan Khoronzhuk (6): net: core: dev_addr_lists: add VID to device address net: 8021q: vlan_dev: add vid tag to addresses of uc and mc lists net: 8021q: vlan_dev: add vid tag for vlan device own address ethernet: eth: add default vid len for all ehternet kind devices net: ethernet: ti: cpsw: update mc filtering to use IVDF net: ethernet: ti: cpsw: add macvlan and ucast/vlan filtering support drivers/net/ethernet/ti/Kconfig | 1 + drivers/net/ethernet/ti/cpsw.c | 139 ++++++++++++-------------------- include/linux/if_vlan.h | 2 + include/linux/netdevice.h | 4 + net/8021q/Kconfig | 12 +++ net/8021q/vlan.c | 3 + net/8021q/vlan.h | 2 + net/8021q/vlan_core.c | 25 ++++++ net/8021q/vlan_dev.c | 103 ++++++++++++++++++----- net/core/dev_addr_lists.c | 124 ++++++++++++++++++++++------ net/ethernet/eth.c | 10 ++- 11 files changed, 292 insertions(+), 133 deletions(-)