Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp935922pxb; Thu, 5 Nov 2020 17:57:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoOtUUti1lXEhtExR+NT0AL96bSGCwQjiERPvLaVf2Y/ZOklOKb9fmULnsVJKOObZItvsw X-Received: by 2002:a50:d84a:: with SMTP id v10mr5794504edj.84.1604627823161; Thu, 05 Nov 2020 17:57:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604627823; cv=none; d=google.com; s=arc-20160816; b=UKZmdr4s1m8qZCYL0zhThiMOraq1yNoQcNfAvoRkwzGwba2xCvqzlo8ljfwObtEkdK Q6HriMHAdSi7R8eBq1vOGkCZ1PJlWCMuefwMSWfJnJviAe9QjfeM5DN8HXRUu5wHV1ks HsxSo/vQeCJHO4/LuUNukB6FfCj8auYiIaD2VcR6x3lP/WBW/FfnsTocIE6hck2ky+yq EY/TKiP7p0sH7YNBoWSBtclgx5GZ65XjCX7+69EoqFd0TFp6J2H+z7gtgwdhz4wjTdNt avd9gHLOyR4dJCVW7c0dMnt7eLBO8hVT3gYESHB6dHyfblzT0mQ2psQXd15nPsfCiZBi Vfpg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=1h5Gb+ysObCE3VboBRxp64zHSYKOI3zJBhAhAbBbJ/c=; b=CRocAiBtT3wl36SHN7VZHEqY9UUyN7H2uX9OueiWhbNNXKYrWMdl5NUGsfZpvHSjni taXcHKciZA2E35UV4lWixx6gnV5qTwIe6TJff18V8ltygZE8Nj8+IrdWJbihFJa6rJgG L+TBDfU+HkRsDTTPLyJxDckl3qK2K6DViSKQKQIYaB9hwlIyDWcynUdIY1eztsXAuHmT oTBW86ehmBRoQIoBmsOlxrxz8ez4NHte+R18R8vFCjNBFWHinwhmvVHl/L3JvkolKdhi QIlys/H3liFJXKmgCZxVVH08VXYXo4qs0tTZo0jXON+Jv0Zymb/aQN5PYD6/bqID4eNy 1xzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jIpCNYyp; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si2703107edx.251.2020.11.05.17.56.40; Thu, 05 Nov 2020 17:57:03 -0800 (PST) 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=@kernel.org header.s=default header.b=jIpCNYyp; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732866AbgKFBwz (ORCPT + 99 others); Thu, 5 Nov 2020 20:52:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:33714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730414AbgKFBwz (ORCPT ); Thu, 5 Nov 2020 20:52:55 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 942EC206FB; Fri, 6 Nov 2020 01:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604627574; bh=pHVYKkUiefYFZk5zGyqOPxW1EYRdawa7eqh570usVN4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jIpCNYypwUEUP3ek2nGHn7uaFGbGarWNBSq4n4C7NeuUapQcQ17PjtyBPEMopYHM2 bJMCpcIfuyK8hzRSZF0a+cGWHmQFWhYJ0mSZxhrROh3XuABAK84FUT7opNsj01FHl0 ap3SBxa5VwPbk0btx0F7yGKKbWvxBwa8kqlHFLLc= Date: Thu, 5 Nov 2020 17:52:52 -0800 From: Jakub Kicinski To: Pavana Sharma Cc: andrew@lunn.ch, ashkan.boldaji@digi.com, davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, marek.behun@nic.cz, netdev@vger.kernel.org, vivien.didelot@gmail.com Subject: Re: [PATCH v8 4/4] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell Message-ID: <20201105175252.12bdc0d3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Nov 2020 18:50:38 +1000 Pavana Sharma wrote: > The Marvell 88E6393X device is a single-chip integration of a 11-port > Ethernet switch with eight integrated Gigabit Ethernet (GbE) transceivers > and three 10-Gigabit interfaces. > > This patch adds functionalities specific to mv88e6393x family (88E6393X, > 88E6193X and 88E6191X) Please fix all checkpatch --strict --min-conf-desc-length=80 warnings and what I point out below > Co-developed-by: Ashkan Boldaji > Signed-off-by: Ashkan Boldaji > Signed-off-by: Pavana Sharma > + reg &= ~(MV88E6XXX_PORT_MAC_CTL_SPEED_MASK | > + MV88E6390_PORT_MAC_CTL_ALTSPEED | > + MV88E6390_PORT_MAC_CTL_FORCE_SPEED); Align the continuation lines under the opening bracket, like the kernel coding style require, please. > + > + if (speed != SPEED_UNFORCED) > + reg |= MV88E6390_PORT_MAC_CTL_FORCE_SPEED; > + > + reg |= ctrl; > + > + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg); > + if (err) > + return err; > + > + return 0; no need to set err, just directly do: return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg); > +} > + > static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, > phy_interface_t mode, bool force) > { > +/* Offset 0x0E: Policy & MGMT Control Register for FAMILY 6191X 6193X 6393X*/ Missing space at the end of that comment. > +static int mv88e6393x_port_policy_write(struct mv88e6xxx_chip *chip, u16 pointer, > + u8 data) > +{ > + > + int err = 0; > + int port; > + u16 reg; > + > + /* Setup per Port policy register */ > + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { > + if (dsa_is_unused_port(chip->ds, port)) > + continue; > + > + /* Prevent the use of an invalid port. */ > + if (mv88e6xxx_is_invalid_port(chip, port)) { > + dev_err(chip->dev, "port %d is invalid\n", port); > + err = -EINVAL; did you mean to exit here? this assignment looks pointless > + } > + reg = MV88E6393X_PORT_POLICY_MGMT_CTL_UPDATE | pointer | data; > + err = mv88e6xxx_port_write(chip, port, MV88E6393X_PORT_POLICY_MGMT_CTL, reg); > + } > + return err; > +} > +int mv88e6393x_port_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) > +{ > + u16 ptr; > + int err; > + > + /* Consider the frames with reserved multicast destination > + * addresses matching 01:80:c2:00:00:00 and > + * 01:80:c2:00:00:02 as MGMT. > + */ > + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XLO; > + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); > + if (err) > + return err; > + > + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XHI; > + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); > + if (err) > + return err; > + > + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XLO; > + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); > + if (err) > + return err; > + > + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XHI; > + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); > + if (err) > + return err; > + > + return 0; return mv... > +} > + > + err = mv88e6xxx_port_write(chip, port, MV88E6393X_PORT_EPC_CMD, val); > + if (err) > + return err; > + > + return 0; ditto > +} > + > +int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, > + bool on) > +{ > + if (port == 0 || port == 9 || port == 10) { Flip the condition, return early. Entire body of a function should not have to be indented. > + u8 cmode = chip->ports[port].cmode; > + > + mv88e6393x_serdes_port_config(chip, lane, on); > + > + switch (cmode) { > + case MV88E6XXX_PORT_STS_CMODE_1000BASEX: > + case MV88E6XXX_PORT_STS_CMODE_2500BASEX: > + return mv88e6390_serdes_power_sgmii(chip, lane, on); > + case MV88E6XXX_PORT_STS_CMODE_10GBASER: > + return mv88e6390_serdes_power_10g(chip, lane, on); > + } > + } > + > + return 0; > +} > @@ -130,7 +169,7 @@ int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); > void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); > > /* Return the (first) SERDES lane address a port is using, ERROR otherwise. */ > -static inline u8 mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, > +static inline int mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, > int port) Looks like this should be in patch 3? > { > if (!chip->info->ops->serdes_get_lane)