Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp66347pxb; Mon, 13 Sep 2021 13:06:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf8vqOUqmZqRvFn98EhYSfeTLTtKpc/WWyon2+nHErdyDHwlyhXSgLm3SFbn/XPj0vpIAV X-Received: by 2002:a17:906:d789:: with SMTP id pj9mr14164428ejb.134.1631563580628; Mon, 13 Sep 2021 13:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563580; cv=none; d=google.com; s=arc-20160816; b=anUpf/r5ADAv1r87uxKVV0zIsUNSnHQcqnH/L5pI6g/wYu8BXyf9seBO/s/9icO+j8 I3oMf7TS+nLNCPgS2yG3m51NYH2OPagK/lcNUOIaBs+LOw/L8+Lts0Vcasuwe6l8zNdZ UfoofIxacqf5L3JdUGbgVHhLinUls38KgVMcKoY5XGzX0OEAaL5HWyo8BJ7HI20gNdst HW+Br1S5alTtBbTj9GpJ8FEO4sSV5N82ldpNfCJ0vV0YgDOX1adLDHAaEm/RCXqnnhb1 PnB38GIDewGBkznuVGaFHSfm25EgY6G5VHOGWmYz7fOe9o4PJZp+n3dLoMW9W3NXyWQd Rb3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o1LsXWgK6FLN+PLIw0n5aEEeQAqBU9TSKxIY/hj5YzI=; b=0xzzm2OlexVmNmg/bsDKunHPH98Q+rUEOSNl6cHtJqunfoZ9skEjXTIypS7aCv1zsv BIDF5hnIL/VvmYPhsGRXHpVjnaDfCVbvNx2OSu9jlMqvH7ZZTUpU4zFi+jt17tx1GzFV ZjbUMh/hwWgKfezpMN2hDwuXPk63N4MWkAMfm+y53S2if/SmMs5N9HkU6bHVPgAk8UR6 dbnz/NvWkPUz9Nsrn8stP18KinByrCsbuirauD4UdY6V/htLAdGNahOWiBYJ6Y+gbTi3 pB2U7js20IA9/rUz/EOGecYyNvKWwCnJoEX40Fb0cOHzj48KjrAku9XKYlBWMGV6o1vl wyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wSSwj/ar"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd19si9528292ejc.48.2021.09.13.13.05.48; Mon, 13 Sep 2021 13:06:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wSSwj/ar"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243733AbhIMNox (ORCPT + 99 others); Mon, 13 Sep 2021 09:44:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243762AbhIMNkB (ORCPT ); Mon, 13 Sep 2021 09:40:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B299C6127A; Mon, 13 Sep 2021 13:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539741; bh=JvuB5ko9wrMvIn1mwuYuiMmamvdRVizbKxdxZM+s5Xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSSwj/arVfXG3NPFoBYSWFx0N3PnkBZVKxdFXs2LVCHjoVCGfe+eUisadNZw0WcMq 1sakD0hid86lluillI6vzrgRUclh5/t9Ke2forAE2BHWAi2MjbMRRC/LoUbsQ16UXw te5iUDwTJLrtxffok/sgOTHtkwxp1N5xMmdtF7uM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 143/236] net/mlx5: Register to devlink ingress VLAN filter trap Date: Mon, 13 Sep 2021 15:14:08 +0200 Message-Id: <20210913131105.222751786@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aya Levin [ Upstream commit 82e6c96f04e13c72d91777455836ffd012853caa ] Add traps registration to mlx5_core devlink register/unregister flow. This patch registers INGRESS_VLAN_FILTER trap. Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../net/ethernet/mellanox/mlx5/core/devlink.c | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index bf5cf022e279..2c7f2eff1e17 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -376,6 +376,48 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) #endif } +#define MLX5_TRAP_DROP(_id, _group_id) \ + DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \ + DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \ + DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT) + +static const struct devlink_trap mlx5_traps_arr[] = { + MLX5_TRAP_DROP(INGRESS_VLAN_FILTER, L2_DROPS), +}; + +static const struct devlink_trap_group mlx5_trap_groups_arr[] = { + DEVLINK_TRAP_GROUP_GENERIC(L2_DROPS, 0), +}; + +static int mlx5_devlink_traps_register(struct devlink *devlink) +{ + struct mlx5_core_dev *core_dev = devlink_priv(devlink); + int err; + + err = devlink_trap_groups_register(devlink, mlx5_trap_groups_arr, + ARRAY_SIZE(mlx5_trap_groups_arr)); + if (err) + return err; + + err = devlink_traps_register(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr), + &core_dev->priv); + if (err) + goto err_trap_group; + return 0; + +err_trap_group: + devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr, + ARRAY_SIZE(mlx5_trap_groups_arr)); + return err; +} + +static void mlx5_devlink_traps_unregister(struct devlink *devlink) +{ + devlink_traps_unregister(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr)); + devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr, + ARRAY_SIZE(mlx5_trap_groups_arr)); +} + int mlx5_devlink_register(struct devlink *devlink, struct device *dev) { int err; @@ -390,8 +432,16 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev) goto params_reg_err; mlx5_devlink_set_params_init_values(devlink); devlink_params_publish(devlink); + + err = mlx5_devlink_traps_register(devlink); + if (err) + goto traps_reg_err; + return 0; +traps_reg_err: + devlink_params_unregister(devlink, mlx5_devlink_params, + ARRAY_SIZE(mlx5_devlink_params)); params_reg_err: devlink_unregister(devlink); return err; @@ -399,6 +449,7 @@ params_reg_err: void mlx5_devlink_unregister(struct devlink *devlink) { + mlx5_devlink_traps_unregister(devlink); devlink_params_unregister(devlink, mlx5_devlink_params, ARRAY_SIZE(mlx5_devlink_params)); devlink_unregister(devlink); -- 2.30.2