Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp721746ybx; Tue, 5 Nov 2019 04:37:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyamcmCUwDONJNpiwEqV0X4uNXoSgFExwLnG3M4t4lOuBjcR7uu/UG9Lu+ydr6p4mN/MkZD X-Received: by 2002:a50:aad2:: with SMTP id r18mr36019529edc.44.1572957424499; Tue, 05 Nov 2019 04:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572957424; cv=none; d=google.com; s=arc-20160816; b=lv1a8RKeHnSAN93vEN7ZR0waT/WMehLwPxPF2FBrR26N8gYxRvhXl4kyJFe4V3XWId /4HRtwRwCGnzfRplt63KdxStP3YvJMmkE6YZLwsx6Q6Ac6Xf+HrXIdbsom/1q0rKGf8R 59tJhS4mwDicagyvvA0lSnP+6tilRW/S8jigYoEiVqRCvSKQTSDzqP3qOA5I+mDdK/5A 8JTnFiAkvK9QG+A+5T5H3asOvUToK5fTqV+IfJcDl3qzzgpbb0cDI9/DbnpR7a6DLxhw 0AMi08TnL1HyX7HUJmkF2DSmXMutLId0pA4Nelv/BlKKT51Dk3oMy+D5LGdMpeiWFnI5 ZtZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Fpy29aEk5vwGaf7dz8Q/ArkTKuvBvu+EQqAdiMmZrYM=; b=QGd8v7Vtg35CawP6cjuxcxaNp/3sYqUCbWSyUNshnT6ad1HE23dH62u/Y/FBVpzBgx QhcKwcyAfT3kCwMYRafolMYxWQ/DrETGHHhPc+dvNFifv+/xn/P5y0Gl7tZwmShxPUzh Sh5YWrHaj60pBb2IzBULweqfbcS4fzeoz9fHNCzQSfgfGaAxN1jPrNVr21sAxbsLMVh0 SEb0X5+GwuTM3T4iIUgeyTHAoE4gVfUCDjfpMfnjdQgi/WsCJOa9lt10SOeVdqK3OOBd rj63B+v4ONSOc6W4WrsERpfE8BPpNKHnCeKKxtjeqnBvggt9ETJKy9M09ZToHDHBJ5Bg zQ5w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si12971767ejj.40.2019.11.05.04.36.41; Tue, 05 Nov 2019 04:37:04 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388833AbfKEMfY (ORCPT + 99 others); Tue, 5 Nov 2019 07:35:24 -0500 Received: from inva020.nxp.com ([92.121.34.13]:59580 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388626AbfKEMfA (ORCPT ); Tue, 5 Nov 2019 07:35:00 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B321E1A01F8; Tue, 5 Nov 2019 13:34:58 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A62541A01E9; Tue, 5 Nov 2019 13:34:58 +0100 (CET) Received: from fsr-ub1464-137.ea.freescale.net (fsr-ub1464-137.ea.freescale.net [10.171.82.114]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 70AB3205ED; Tue, 5 Nov 2019 13:34:58 +0100 (CET) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, Ioana Ciornei Subject: [PATCH 10/12] staging: dpaa2-ethsw: enable the CTRL_IF based on the FW version Date: Tue, 5 Nov 2019 14:34:33 +0200 Message-Id: <1572957275-23383-11-git-send-email-ioana.ciornei@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572957275-23383-1-git-send-email-ioana.ciornei@nxp.com> References: <1572957275-23383-1-git-send-email-ioana.ciornei@nxp.com> Reply-to: ioana.ciornei@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a features bitmask in the dpaa2-ethsw driver that would be populated based on the running version of MC firmware. The first and only feature, at the moment, is the control traffic which is available only when the DPSW object version is greater than 8.4. Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 13 +++++++++++++ drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index abe920f8a665..df9d81be242b 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -2111,6 +2111,14 @@ static int ethsw_ctrl_if_setup(struct ethsw_core *ethsw) return err; } +void dpaa2_ethsw_set_features(struct ethsw_core *ethsw, + u16 major, u16 minor) +{ + if (major >= DPAA2_ETHSW_CTRL_IF_MIN_MAJOR && + minor >= DPAA2_ETHSW_CTRL_IF_MIN_MINOR) + ethsw->features |= DPAA2_ETHSW_CONTROL_TRAFFIC; +} + static int ethsw_init(struct fsl_mc_device *sw_dev) { struct device *dev = &sw_dev->dev; @@ -2154,6 +2162,11 @@ static int ethsw_init(struct fsl_mc_device *sw_dev) goto err_close; } + /* Compose the set of supported features by + * the current firmware image + */ + dpaa2_ethsw_set_features(ethsw, version_major, version_minor); + err = dpsw_reset(ethsw->mc_io, 0, ethsw->dpsw_handle); if (err) { dev_err(dev, "dpsw_reset err %d\n", err); diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h index 747a4e15d28a..d880a3321e14 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h @@ -116,6 +116,13 @@ struct ethsw_port_priv { u16 tx_qdid; }; +#define DPAA2_ETHSW_CTRL_IF_MIN_MAJOR 8 +#define DPAA2_ETHSW_CTRL_IF_MIN_MINOR 4 + +enum dpaa2_ethsw_features { + DPAA2_ETHSW_CONTROL_TRAFFIC = BIT(0), +}; + /* Switch data */ struct ethsw_core { struct device *dev; @@ -125,6 +132,7 @@ struct ethsw_core { int dev_id; struct ethsw_port_priv **ports; struct iommu_domain *iommu_domain; + int features; u8 vlans[VLAN_VID_MASK + 1]; bool learning; @@ -138,6 +146,9 @@ struct ethsw_core { static inline bool ethsw_has_ctrl_if(struct ethsw_core *ethsw) { + if (!ethsw->features & DPAA2_ETHSW_CONTROL_TRAFFIC) + return false; + return !(ethsw->sw_attr.options & DPSW_OPT_CTRL_IF_DIS); } #endif /* __ETHSW_H */ -- 1.9.1