From patchwork Mon Oct 9 09:15:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 823132 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="vsSqfIU6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y9ZNV041Sz9tXF for ; Mon, 9 Oct 2017 20:15:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754109AbdJIJPw (ORCPT ); Mon, 9 Oct 2017 05:15:52 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:46164 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbdJIJPk (ORCPT ); Mon, 9 Oct 2017 05:15:40 -0400 Received: by mail-wm0-f67.google.com with SMTP id m72so20597153wmc.1 for ; Mon, 09 Oct 2017 02:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=J94203BtLabhZSgKgz6HT8I+HNyb2ZW1z7lU5+iCM0g=; b=vsSqfIU6BXxVBuAnN7m9tWgsXilP0/ZqM1w7lfH3O9p3QgAY8lMyFRTU8IOTAhnHxH jlC4CWxEIkIfCcdA1kVLLozxlEKEfJcU/asOPLAmx3HHW0lvELo5qiSZ4qhadYYFhaid TXgxB2M9ntQXY7mpz+hg6DTEc7yXamgqRVE79koM7jn0Y/8PFaDecdVA9s82PT6bNAwt jPt20LmUxzXuOps3zaOB6NRfrgHCfgBS7nLmihN5yWNr0Ochw5JrIiFYFCH1SakDjB9q A4Cd1tngDsukmRA4lcqjbNj6cpen1cApVayx0/LpJA+zIfmTWaRIHQIvgBs420hGOrmh gsMg== 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:in-reply-to :references; bh=J94203BtLabhZSgKgz6HT8I+HNyb2ZW1z7lU5+iCM0g=; b=aMMboZe1UG60Pcoe+2f2UNKIEWNCCcoY1Z1wpAIGRS2d/KZ8tVycx71g+wv/+Qt9IO fsCr6r0MuqEEA5rNgLVNzVg5M/R8iC0ulAp0V3waH6z85Lwkgwx68V/qOjwqG1kfLOAF 2aG3rIgTJnl6aG9ta7PQpVfsTqvyYn10eejRdz71qR8fW1hgtqkOOUEkTp9N2lXehfiw NKpEVtMoc6OW+tfTWuCFp7f0EMfVRS10lIkIPJeroflIlFuKtIiaw5bUhNEuJ0STnsmf dXRXZFaLxcFaCycOrEADUu7qkTO8hi7kq40HFlYxSwwQYxp+zbhsS5Yxdc6UL+b3iQwX U+rg== X-Gm-Message-State: AMCzsaXpbQhKLpgXxkMOeW1ypHjvJWPV0X+Dex1qdH3NLR6clRVv9Q33 5UbwSP2wbj+W5VVKW+AeT09Ukikj X-Google-Smtp-Source: AOwi7QBGdZC+2byEKStN/PQG/wNOLywpXIGXN+LObbZJP/u0qaAtLe0i3dfiBeWj8B/QaMJPlI6Q+A== X-Received: by 10.28.97.194 with SMTP id v185mr8202023wmb.117.1507540539602; Mon, 09 Oct 2017 02:15:39 -0700 (PDT) Received: from localhost (ip-89-177-136-69.net.upcbroadband.cz. [89.177.136.69]) by smtp.gmail.com with ESMTPSA id 9sm6043763wml.24.2017.10.09.02.15.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2017 02:15:39 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, yotamg@mellanox.com, idosch@mellanox.com, nogahf@mellanox.com, mlxsw@mellanox.com, ivecera@redhat.com, nikolay@cumulusnetworks.com, andrew@lunn.ch, stephen@networkplumber.org, nbd@nbd.name, roopa@cumulusnetworks.com Subject: [patch net-next v2 4/5] mlxsw: spectrum_switchdev: Add support for router port in SMID entries Date: Mon, 9 Oct 2017 11:15:34 +0200 Message-Id: <20171009091535.1315-5-jiri@resnulli.us> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171009091535.1315-1-jiri@resnulli.us> References: <20171009091535.1315-1-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Yotam Gigi In Spectrum, MDB entries point to MID entries, that indicate which ports a packet should be forwarded to. Add the support in creating MID entries that forward the packet to the Spectrum router port. This will be later used to handle the bridge mrouter port switchdev notifications. Signed-off-by: Yotam Gigi Reviewed-by: Nogah Frankel Signed-off-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 2cfdf22..4b4584f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -49,6 +49,7 @@ #include #include +#include "spectrum_router.h" #include "spectrum.h" #include "core.h" #include "reg.h" @@ -1243,7 +1244,8 @@ static int mlxsw_sp_port_mdb_op(struct mlxsw_sp *mlxsw_sp, const char *addr, } static int mlxsw_sp_port_smid_full_entry(struct mlxsw_sp *mlxsw_sp, u16 mid_idx, - long *ports_bitmap) + long *ports_bitmap, + bool set_router_port) { char *smid_pl; int err, i; @@ -1258,9 +1260,15 @@ static int mlxsw_sp_port_smid_full_entry(struct mlxsw_sp *mlxsw_sp, u16 mid_idx, mlxsw_reg_smid_port_mask_set(smid_pl, i, 1); } + mlxsw_reg_smid_port_mask_set(smid_pl, + mlxsw_sp_router_port(mlxsw_sp), 1); + for_each_set_bit(i, ports_bitmap, mlxsw_core_max_ports(mlxsw_sp->core)) mlxsw_reg_smid_port_set(smid_pl, i, 1); + mlxsw_reg_smid_port_set(smid_pl, mlxsw_sp_router_port(mlxsw_sp), + set_router_port); + err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(smid), smid_pl); kfree(smid_pl); return err; @@ -1364,7 +1372,8 @@ mlxsw_sp_mc_write_mdb_entry(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_mc_get_mrouters_bitmap(flood_bitmap, bridge_device, mlxsw_sp); mid->mid = mid_idx; - err = mlxsw_sp_port_smid_full_entry(mlxsw_sp, mid_idx, flood_bitmap); + err = mlxsw_sp_port_smid_full_entry(mlxsw_sp, mid_idx, flood_bitmap, + false); kfree(flood_bitmap); if (err) return false;