From patchwork Wed Jul 4 18:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141082 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1096516ljj; Wed, 4 Jul 2018 11:35:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf/BScVjSq3nWnFQYjg4PTOVx2Ss588Rj4tkj3oGQlJwo4FnlJumbxCCV/weauvGyxbztrN X-Received: by 2002:a17:902:345:: with SMTP id 63-v6mr3184831pld.328.1530729336584; Wed, 04 Jul 2018 11:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729336; cv=none; d=google.com; s=arc-20160816; b=Z0KvkkINRrzEIDOUNxf6f97qH6+gV7SnmIMPdD19iZYZq0ySzsmts2CvTEgHkrakuP IFEhPnzO8Dycj6E6z8nOjxlTN0TXp1Il5/YeXvuyYGsxHkpQD7vfBe1GkMsXRXdhrhxn mDDf9+pUW0fw9HJErKTY7UHDiKrS/0MswLdOocTTi/jJ5IDZcBbAcyWOgYfSzpfkhAzL 452+Ur7OV4AxDzz32HywHXrDY6f1XLh3l+ncUzALLJh2p+O8y2bFMmGseiWZ6GMUCsem 7mXGUHDGIbBQjnHgJFrQkMCmNNV+KZO3YpjsD9yarKFn7Ihu7c1wn2JsUsH6R6/azZ6M T0yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=TmRfJbI9A2u95XT6ot+9VMvVgQcawycnmBgnQFkZg1g=; b=pvwd8j5sDScthlvQbU1fchPnsejrQh+DWRJwrB2jCLb6pKmXROZvQtrpsorsw57YNY AY4lLxVMmcuTkmOkeW2nWfjcXSKDLSShZFQcgRHsM5FD2lZfQJmwewQYeyXEEaI9Bszh qU6tdS4k8OElzE/e4UHrpFnlBCBXczxUZCWe5jFQKRYa5c/JZgiSG+pIoESMCXQdYc1K 9Ceer0ZWEXmYpY1s6BGwOie9RcbCaWWaZ0ki8VuPguYjlE/bLxJ6BBBotuj5D4rXqntG qWCMP5gSY4+VlhHb28FHcSLEXUMFOMvcS6gnXxsW0GqUzQVS4UHMK396dyYbZqjLwbNm oBEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uh74O0HI; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si3961989pgh.569.2018.07.04.11.35.36; Wed, 04 Jul 2018 11:35:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uh74O0HI; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752533AbeGDSfe (ORCPT + 10 others); Wed, 4 Jul 2018 14:35:34 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46082 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeGDSfd (ORCPT ); Wed, 4 Jul 2018 14:35:33 -0400 Received: by mail-lf0-f67.google.com with SMTP id l16-v6so5008513lfc.13 for ; Wed, 04 Jul 2018 11:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=TmRfJbI9A2u95XT6ot+9VMvVgQcawycnmBgnQFkZg1g=; b=Uh74O0HI8xcC2jZtKL04Jox5lofVEN2AKykXwsOIRaSAeN6x7jx9iF+vVzJU7mcB3C 47Yb5+LGVPKE8MjXbu2Qqd24oPsqw9OcwZ9cGdUb1t7ZHrT0rx45R+PLXV0hiEOAqQCc uZMbGKBP3HwL2h7tv8NO0zCi9P3KwDEK0Ebko= 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=TmRfJbI9A2u95XT6ot+9VMvVgQcawycnmBgnQFkZg1g=; b=Lw7Qf9jjnCZOp8YRM8hawZv5Am+l+qfzaGSyGLt/newXjfhx1xkwWCJOrV6H+yuZcj /vRtnH05rWeIHqiegJUEyl/TR/VJC4hfKG13xBzJgEfQG+9/gayBZ5mPBOyNHp7je/LF Y6v8OY292nCaOlBhp6QUVwll4SHFiRiekEz3WO+RUddvIh/vYctsvLlEDqQ5O9NYSLD2 UvrGklaciLNwHZYtROd0aq6PtjPlaFTv6xqiurJS9gHzlAdUhqrzMJbff1HeBzTIET0v y48mUA+U5VKI5jAu36oeRd41ycs6QAyB7+C7R5jbqKtxuXoN2IOalUQSUSgoi+eY0Gd9 3ywA== X-Gm-Message-State: APt69E2mkhpX4Hh3yBTDSFbxjEopMYusfBu2NRXB4FiQygtADfV9UlRZ ebBxq0hgR+UulfwEdwenjj8+60uNwIk= X-Received: by 2002:a19:6b03:: with SMTP id d3-v6mr2236796lfa.81.1530729331681; Wed, 04 Jul 2018 11:35:31 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id g2-v6sm681094ljj.53.2018.07.04.11.35.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:35:30 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 1/5 v2] net: gemini: Look up L3 maxlen from table Date: Wed, 4 Jul 2018 20:33:20 +0200 Message-Id: <20180704183324.10605-1-linus.walleij@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 The code to calculate the hardware register enumerator for the maximum L3 length isn't entirely simple to read. Use the existing defines and rewrite the function into a table look-up. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - No changes, just resending with the rest. --- drivers/net/ethernet/cortina/gemini.c | 61 ++++++++++++++++++++------- 1 file changed, 46 insertions(+), 15 deletions(-) -- 2.17.1 Acked-by: Michał Mirosław diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 6d7404f66f84..8fc31723f700 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -401,26 +401,57 @@ static int gmac_setup_phy(struct net_device *netdev) return 0; } -static int gmac_pick_rx_max_len(int max_l3_len) -{ - /* index = CONFIG_MAXLEN_XXX values */ - static const int max_len[8] = { - 1536, 1518, 1522, 1542, - 9212, 10236, 1518, 1518 - }; - int i, n = 5; +/* The maximum frame length is not logically enumerated in the + * hardware, so we do a table lookup to find the applicable max + * frame length. + */ +struct gmac_max_framelen { + unsigned int max_l3_len; + u8 val; +}; - max_l3_len += ETH_HLEN + VLAN_HLEN; +static const struct gmac_max_framelen gmac_maxlens[] = { + { + .max_l3_len = 1518, + .val = CONFIG0_MAXLEN_1518, + }, + { + .max_l3_len = 1522, + .val = CONFIG0_MAXLEN_1522, + }, + { + .max_l3_len = 1536, + .val = CONFIG0_MAXLEN_1536, + }, + { + .max_l3_len = 1542, + .val = CONFIG0_MAXLEN_1542, + }, + { + .max_l3_len = 9212, + .val = CONFIG0_MAXLEN_9k, + }, + { + .max_l3_len = 10236, + .val = CONFIG0_MAXLEN_10k, + }, +}; + +static int gmac_pick_rx_max_len(unsigned int max_l3_len) +{ + const struct gmac_max_framelen *maxlen; + int maxtot; + int i; - if (max_l3_len > max_len[n]) - return -1; + maxtot = max_l3_len + ETH_HLEN + VLAN_HLEN; - for (i = 0; i < 5; i++) { - if (max_len[i] >= max_l3_len && max_len[i] < max_len[n]) - n = i; + for (i = 0; i < ARRAY_SIZE(gmac_maxlens); i++) { + maxlen = &gmac_maxlens[i]; + if (maxtot <= maxlen->max_l3_len) + return maxlen->val; } - return n; + return -1; } static int gmac_init(struct net_device *netdev) From patchwork Wed Jul 4 18:33:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141083 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1097778ljj; Wed, 4 Jul 2018 11:37:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfPNn/DxdH+M7u8BuHbW6CcNQwWnXrZE55Vdh2RlxPFlVFF9lJJaRgHu6TWyir8FFiekNuq X-Received: by 2002:a63:62c4:: with SMTP id w187-v6mr2841689pgb.55.1530729447092; Wed, 04 Jul 2018 11:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729447; cv=none; d=google.com; s=arc-20160816; b=w/Z4eQeSLPyzstnAM0JNxIpdSxvs1soHN0LlzYZwbi6U1G/1EGu5gHRkhnniUwTtfF Cmt0Fb/i6WaMhMXf2UkbibfV8WuQVU4yP2ozWqsnW0hxZNtIef42X0KUZBGlfjGVM8ky No1eQVUALppJl+8s36psvg7zLtJha87T5eCgcWiEzFvDf2wfFqFQIlBFqOv1LTeBy3NO kSeMu7d4f4i0NlpnQJ35L/S5D6CiSKTjBfnsywBuQqoQzStYBnqmhWqv1/+X8XqbCgLA SoNmO7t/EiVlXfBvvUz0cMw1t1fcw8rTrljlonjZNJpI0KupZaJ19UK6StrUdgRY8qoa N64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=PfhfzKxlNfEfFpA8vJF5dQG4cqFlRqifR8hkvo6DffeNoYptEW/oqcpeG36T/E3D8R JVBRmxdp7JP7xl54JS4cE44fNdUI+U8cSPYUjvYe8acvbp7emY3Ys0CEQfbyxwkCx3Lt HwYxeMlJUpuQ6unyYGbgoh+X9eXdDHKo5aZnuMvN4c0aoUiAQiGhZDTK7QIzt/zOwU6T 9v8Pj3nP0/K5kDUZCo77jzu3SFAXla5VKY2sbDhk0SOnSI8A18Tx3oWM5drllf5E4k1k MLnWehVx4ZT3Cx79FD2mg8FEchkM8CSkv68q/DaLGbrW3nk3UNPn9QZaZ5kBQdZocIPv cq1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fodfploV; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si3961989pgh.569.2018.07.04.11.37.26; Wed, 04 Jul 2018 11:37:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fodfploV; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752622AbeGDShY (ORCPT + 10 others); Wed, 4 Jul 2018 14:37:24 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33205 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbeGDShX (ORCPT ); Wed, 4 Jul 2018 14:37:23 -0400 Received: by mail-lj1-f193.google.com with SMTP id t21-v6so4914533lji.0 for ; Wed, 04 Jul 2018 11:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=fodfploVfoTrDn8oeWXnVpwJbt3dkr943G7vW2DdK27G0l3xZRYOnM4YfQSTkhYo7X zdc3fCynrxEK8Iau6YZ/CHkWXrzeHv4uefjdXry34yJJBcZuGMFxMl/l1EmcFBaDOz6h kx2Vc2wfgzw0s3LvzgbhDd9vRP5gX+YKwWF64= 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=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=qeBjaQDSnhmcBjUsjgjgaSeBGTHDsk8nF4PSeSspjSO2OmG42oMZfZOXOndkdBCJUr WzDPAsRGj7rIEvs9o+GhfZE6pd8B4I3TOTEdjvqoxcYAOaQni4mshMr1NfG/f3jRioqv P/huj05vvKlEcB2kIgQRvwS1AdCn58j3K8SSzE5t0fMNs6wp5lHEHxzm3WNjErKGR8Ai 0wCJVEd8SAnjMjKKtdm+ZalY7uprr6fEXtsGEbQeHzWwyifAqShWqm8Y4HsFCYPrIC8w oHUhA9lcBbIA6zVGBQyVQG+4P3FPEErL9ae66lqCHCulvVCjvPyCYi4qccTGDITUSuSk r9zQ== X-Gm-Message-State: APt69E2Y2UuXFFcBP8jt1eitwiL+KGsbf0qXrZrOdiUjzHmzHO04ePXY dslIRu+5vvPqlstUODXEBauDkyCAwsY= X-Received: by 2002:a2e:2282:: with SMTP id i124-v6mr2061962lji.11.1530729441954; Wed, 04 Jul 2018 11:37:21 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id g2-v6sm681094ljj.53.2018.07.04.11.37.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:37:20 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 2/5 v2] net: gemini: Improve connection prints Date: Wed, 4 Jul 2018 20:33:21 +0200 Message-Id: <20180704183324.10605-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704183324.10605-1-linus.walleij@linaro.org> References: <20180704183324.10605-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Switch over to using a module parameter and debug prints that can be controlled by this or ethtool like everyone else. Depromote all other prints to debug messages. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Use a module parameter and the message levels like all other drivers and stop trying to be special. --- drivers/net/ethernet/cortina/gemini.c | 44 +++++++++++++++------------ 1 file changed, 25 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 8fc31723f700..f219208d2351 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -46,6 +46,11 @@ #define DRV_NAME "gmac-gemini" #define DRV_VERSION "1.0" +#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) +static int debug = -1; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); + #define HSIZE_8 0x00 #define HSIZE_16 0x01 #define HSIZE_32 0x02 @@ -300,23 +305,26 @@ static void gmac_speed_set(struct net_device *netdev) status.bits.speed = GMAC_SPEED_1000; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) status.bits.mii_rmii = GMAC_PHY_RGMII_1000; - netdev_info(netdev, "connect to RGMII @ 1Gbit\n"); + netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", + phydev_name(phydev)); break; case 100: status.bits.speed = GMAC_SPEED_100; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; - netdev_info(netdev, "connect to RGMII @ 100 Mbit\n"); + netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", + phydev_name(phydev)); break; case 10: status.bits.speed = GMAC_SPEED_10; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; - netdev_info(netdev, "connect to RGMII @ 10 Mbit\n"); + netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", + phydev_name(phydev)); break; default: - netdev_warn(netdev, "Not supported PHY speed (%d)\n", - phydev->speed); + netdev_warn(netdev, "Unsupported PHY speed (%d) on %s\n", + phydev->speed, phydev_name(phydev)); } if (phydev->duplex == DUPLEX_FULL) { @@ -363,11 +371,8 @@ static int gmac_setup_phy(struct net_device *netdev) return -ENODEV; netdev->phydev = phy; - netdev_info(netdev, "connected to PHY \"%s\"\n", - phydev_name(phy)); - phy_attached_print(phy, "phy_id=0x%.8lx, phy_mode=%s\n", - (unsigned long)phy->phy_id, - phy_modes(phy->interface)); + netdev_dbg(netdev, "connected to PHY \"%s\"\n", + phydev_name(phy)); phy->supported &= PHY_GBIT_FEATURES; phy->supported |= SUPPORTED_Asym_Pause | SUPPORTED_Pause; @@ -376,19 +381,19 @@ static int gmac_setup_phy(struct net_device *netdev) /* set PHY interface type */ switch (phy->interface) { case PHY_INTERFACE_MODE_MII: - netdev_info(netdev, "set GMAC0 to GMII mode, GMAC1 disabled\n"); + netdev_dbg(netdev, + "MII: set GMAC0 to GMII mode, GMAC1 disabled\n"); status.bits.mii_rmii = GMAC_PHY_MII; - netdev_info(netdev, "connect to MII\n"); break; case PHY_INTERFACE_MODE_GMII: - netdev_info(netdev, "set GMAC0 to GMII mode, GMAC1 disabled\n"); + netdev_dbg(netdev, + "GMII: set GMAC0 to GMII mode, GMAC1 disabled\n"); status.bits.mii_rmii = GMAC_PHY_GMII; - netdev_info(netdev, "connect to GMII\n"); break; case PHY_INTERFACE_MODE_RGMII: - dev_info(dev, "set GMAC0 and GMAC1 to MII/RGMII mode\n"); + netdev_dbg(netdev, + "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; - netdev_info(netdev, "connect to RGMII\n"); break; default: netdev_err(netdev, "Unsupported MII interface\n"); @@ -1307,8 +1312,8 @@ static void gmac_enable_irq(struct net_device *netdev, int enable) unsigned long flags; u32 val, mask; - netdev_info(netdev, "%s device %d %s\n", __func__, - netdev->dev_id, enable ? "enable" : "disable"); + netdev_dbg(netdev, "%s device %d %s\n", __func__, + netdev->dev_id, enable ? "enable" : "disable"); spin_lock_irqsave(&geth->irq_lock, flags); mask = GMAC0_IRQ0_2 << (netdev->dev_id * 2); @@ -1813,7 +1818,7 @@ static int gmac_open(struct net_device *netdev) HRTIMER_MODE_REL); port->rx_coalesce_timer.function = &gmac_coalesce_delay_expired; - netdev_info(netdev, "opened\n"); + netdev_dbg(netdev, "opened\n"); return 0; @@ -2385,6 +2390,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->id = id; port->geth = geth; port->dev = dev; + port->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); /* DMA memory */ dmares = platform_get_resource(pdev, IORESOURCE_MEM, 0); From patchwork Wed Jul 4 18:33:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141084 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1097850ljj; Wed, 4 Jul 2018 11:37:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjSRBzjQlTFqeC9pIwvigmJWhGTy7A6QNBRjJ0B7R2FJelVySrKOcrTb6HdzLwSCEY7vI/ X-Received: by 2002:a65:5205:: with SMTP id o5-v6mr2842607pgp.108.1530729451586; Wed, 04 Jul 2018 11:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729451; cv=none; d=google.com; s=arc-20160816; b=G0R91c40aZze4fX/RWO0kSViqdjS0B0Kzi+wRg+nWfdY1QMG5KxyL3yi7etS6aJ8x7 IHNBM4b/nZy7QXfORZuuf/wlKJS4MeS0LkKWjoQyfWeKrhHMZ/ciHn0RRFVvZDfFat1g h0/DNgc/qtrRdPDoS2gE/BKfO5ssn7HIdYYiJBBkmNKvm04gEvKYwGjuZftBToBZE8Ki 3uTmaTdUH5Ec9OxKm4SOy4NUd3GLDkYUXd4M4YndoQ/7Rhvqj93WT1WVj85w8H3ZV9yE msxypF1IKSJxd2v1ltCqw/0jMDbU3+EgjPgi6W3qeJSbbC8/OUR0PoZp+PY4hdYvUkxP W9nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6PPBwN1qDeLgFoQGn56q0rsA1XY/V0on4rQshZuYPCw=; b=JNQgn39Eb63E4/E0rn0Uz60kdu0STFHxVrUc2C5tdyPGqCFzWQNgYiNxngXS4srKQp BK54JfoAW2BCRiXYacmiA1Bt/JZehF9p8rbaUqNbb3dQnlf3B58w0XeIeapCcavCkfie 2KSYkZubA43ZHZ5Ms0e4tepxXNbtEthOvTmOHW3sLE20Gq+GAZZKle7Gh4L4ct/TWBpD f9oJSIG+GfwH+rEAVwHxIXzoE9uRsRGWhms1Gmes6s4MwrUmSNfteMJpXx6K1sYj9pKR MYY+ufY0hhocH71vjM/jKg/89w5hDMIKIAbvq6vq9n/XA0Fm5N1sCtP/HXc/cHT3XKET 7HJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hlQKdmbZ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si3961989pgh.569.2018.07.04.11.37.31; Wed, 04 Jul 2018 11:37:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hlQKdmbZ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752755AbeGDSh3 (ORCPT + 10 others); Wed, 4 Jul 2018 14:37:29 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39306 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbeGDSh1 (ORCPT ); Wed, 4 Jul 2018 14:37:27 -0400 Received: by mail-lj1-f193.google.com with SMTP id t7-v6so4905245ljj.6 for ; Wed, 04 Jul 2018 11:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6PPBwN1qDeLgFoQGn56q0rsA1XY/V0on4rQshZuYPCw=; b=hlQKdmbZznJYBiu/9H+2EIo6IYYIpfqelQFdvkNaEUdcHmBJFS8JBI2+EJsmHvDHvy tPRSedgLFUeKWmEdxlxrbGlsPaJxzFSW25hYonKU5CuI7bi5InuCevwGHn+A1YADBBeW KkqFyLQz24Bu2Ni6iFj0nvjWSmQcueNFJmo0Q= 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=6PPBwN1qDeLgFoQGn56q0rsA1XY/V0on4rQshZuYPCw=; b=I7gmeNPSMMXpMDHDlB8j3vAQ4OxPf5d0JQclNDPDtsDpVxJzgLmWf7ws+aOHvGvwHo lWMnAWy7HM4EVibZmUmECCN/ak5vdjirsc3eg9b9HvwZimA+LpU1h1AmgrR6OXNXGNlC ht68CFrwjdtrhcVbXM3oKwUFP4fUb1/4FAAuzfQ9o22ohXcWmbqhIHuj7ib7jEQosdhC fkL6gdSLbtlz0sbRCn2uvu+1rguMhNwj1EeLY8j0HJxtuvDCy0mh9JAPw+ZoctM4KQe1 ufQW9Dtfx2P6BagGSym5mIotNqB4wzZ4fVAvbKG5EZ9lL+rK/rt8rlvlxErv6y8MOoOt cf1w== X-Gm-Message-State: APt69E3VSeZm1KTD6J7q0N/iaI/8FbIYz623C1zn05l2YOAVgM2cXDp4 lXUXHyKPiDYmgAAXL76l4AV7CWZ9PU8= X-Received: by 2002:a2e:5687:: with SMTP id k7-v6mr2172105lje.105.1530729445449; Wed, 04 Jul 2018 11:37:25 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id g2-v6sm681094ljj.53.2018.07.04.11.37.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:37:24 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 3/5 v2] net: gemini: Allow multiple ports to instantiate Date: Wed, 4 Jul 2018 20:33:22 +0200 Message-Id: <20180704183324.10605-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704183324.10605-1-linus.walleij@linaro.org> References: <20180704183324.10605-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The code was not tested with two ports actually in use at the same time. (I blame this on lack of actual hardware using that feature.) Now after locating a system using both ports, add necessary fix to make both ports come up. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - No changes, just resending with the rest. --- drivers/net/ethernet/cortina/gemini.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index f219208d2351..6b5aa5704c4f 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1789,7 +1789,10 @@ static int gmac_open(struct net_device *netdev) phy_start(netdev->phydev); err = geth_resize_freeq(port); - if (err) { + /* It's fine if it's just busy, the other port has set up + * the freeq in that case. + */ + if (err && (err != -EBUSY)) { netdev_err(netdev, "could not resize freeq\n"); goto err_stop_phy; } From patchwork Wed Jul 4 18:33:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141085 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1097896ljj; Wed, 4 Jul 2018 11:37:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc//iUwmMQadkGaexKV2zfZWPWHL+WZlOmevYdN89dd1ocqnyBBcQ5XEsXKoTr4JmATuH6T X-Received: by 2002:a65:6559:: with SMTP id a25-v6mr2805804pgw.82.1530729455041; Wed, 04 Jul 2018 11:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729455; cv=none; d=google.com; s=arc-20160816; b=VjahjHRuHc1/cFQZ+55MrTs7VksNMnkuNTl4aJY764e65QgJSePioJLr0AIj/6TZCi u3j3sPzwD2teAPM5LiDk0tH42m+jT0DZ9U3gsngRD0LMitetSJ2nKxJBnqJ8PKs3UYVU yVRqFqYIAXwjk6DPXx+v/pgL+PKpLkbIyPKt9vUFWi30ID+wPLdal4Xq4rHIXQqTL2kV SAbYmShAsiRTGG8DlAGV+cyYLFIRbflfhL0cswEoH8x3+cx3/ZdfaSpjzIIsgGOfypIr kbPcMfRecMhK0/t4gAqmZ2E3ooNYoQyBuFP4fYLrtMMJ0Eb0SSVjf8V93zLzm9sDXKbo m0pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XrT27mVKerw6PuoIEkPTNA0M5NXJmom0otf62NTCD0w=; b=LNeFPaiORdicPzqUWBy7vsHNB109DdU+BmssBlvWEk9keFOGfTdKFi7QwD3z9KHh0O N5SuF6Zh1GlBMHg1PpPehwzmhTuB4ByeApH6jDm1fdO8HtnS+4QhK9+6axXsbNywLFl9 yf/R+76D+Yp1gjkR2HHYvJXTTH8l/AvsejmbmPBkG1PsyWVOi9NdhXEmabJS/aMhM8nE wEMne/KOYVLTXr6NmYc9xKt4gs6yS90fbkJ/xo9YkYkm0x1hk+orAyjYP3XxrbnLClwa 6qXyKdidJEZzD9eMMxGw4FNpHX6AKrxJq44xi5ju6e/8yyqNhfv/dsPBAttGrPTwtG/d dNhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QOULFqfs; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si3961989pgh.569.2018.07.04.11.37.34; Wed, 04 Jul 2018 11:37:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QOULFqfs; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882AbeGDShc (ORCPT + 10 others); Wed, 4 Jul 2018 14:37:32 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36347 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbeGDSha (ORCPT ); Wed, 4 Jul 2018 14:37:30 -0400 Received: by mail-lj1-f194.google.com with SMTP id u7-v6so2290600lji.3 for ; Wed, 04 Jul 2018 11:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XrT27mVKerw6PuoIEkPTNA0M5NXJmom0otf62NTCD0w=; b=QOULFqfs9ZgQkpbF30MZRqt+wqhVbsKyDcMweXCrDyB3Gxxxf6bdKmUZMSOj59dN+j bMzG+WCSYmWfMTt4TAOdEoSbQICHNoDq9jxUiUlTehLhuVViwRsAQxsyCy7GE0EANDAo IlENZmQXpOVQHg9sp6WNjnceazGDRF23gBufY= 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=XrT27mVKerw6PuoIEkPTNA0M5NXJmom0otf62NTCD0w=; b=mOchBXLutjsBtgd9iPO/fgDAU1XUHi5/bT0s6hj3VqHZcCguuzv2EvsbUF+Clsb6Ou Md0mViZ71M93aJYtHrP83CZqnno7bW9f3Mvrj88tT5oFkLLuLuNSo7LCgerIblRCgwmn tndVPC2drmg/5yAIitsZ2FHzJuYve4DNU9fPlJ2xZzMM6rNIMV4i42HP9J5jHjJVnpt7 GxdlEyerHxZWUShqpfSddVcNvneQ2GWKgXWRkIsafweM3NHwwS2yfheDyBn4IRKa/5UX EtoAjEUSD5ugBcsP1842GR+Nb06YkCV0pfprgei0h2KOkNijlHLgXYkLSZ4eMIrsxjVX tZkQ== X-Gm-Message-State: APt69E1fnHTK6xXHGZzaZpv6NLcIloS5/QL+OSxBAd9hI6oN/zS/C0Hu 58eXH4zpaPkCCvRL6/sfRPwSwrQmVjQ= X-Received: by 2002:a2e:60:: with SMTP id 93-v6mr2213286lja.96.1530729448303; Wed, 04 Jul 2018 11:37:28 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id g2-v6sm681094ljj.53.2018.07.04.11.37.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:37:26 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 4/5 v2] net: gemini: Move main init to port Date: Wed, 4 Jul 2018 20:33:23 +0200 Message-Id: <20180704183324.10605-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704183324.10605-1-linus.walleij@linaro.org> References: <20180704183324.10605-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The initialization sequence for the ethernet, setting up interrupt routing and such things, need to be done after both the ports are clocked and reset. Before this the config will not "take". Move the initialization to the port probe function and keep track of init status in the state. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - No changes, just resending with the rest. --- drivers/net/ethernet/cortina/gemini.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 6b5aa5704c4f..4e341570047f 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -151,6 +151,7 @@ struct gemini_ethernet { void __iomem *base; struct gemini_ethernet_port *port0; struct gemini_ethernet_port *port1; + bool initialized; spinlock_t irq_lock; /* Locks IRQ-related registers */ unsigned int freeq_order; @@ -2303,6 +2304,14 @@ static void gemini_port_remove(struct gemini_ethernet_port *port) static void gemini_ethernet_init(struct gemini_ethernet *geth) { + /* Only do this once both ports are online */ + if (geth->initialized) + return; + if (geth->port0 && geth->port1) + geth->initialized = true; + else + return; + writel(0, geth->base + GLOBAL_INTERRUPT_ENABLE_0_REG); writel(0, geth->base + GLOBAL_INTERRUPT_ENABLE_1_REG); writel(0, geth->base + GLOBAL_INTERRUPT_ENABLE_2_REG); @@ -2450,6 +2459,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) geth->port0 = port; else geth->port1 = port; + + /* This will just be done once both ports are up and reset */ + gemini_ethernet_init(geth); + platform_set_drvdata(pdev, port); /* Set up and register the netdev */ @@ -2567,7 +2580,6 @@ static int gemini_ethernet_probe(struct platform_device *pdev) spin_lock_init(&geth->irq_lock); spin_lock_init(&geth->freeq_lock); - gemini_ethernet_init(geth); /* The children will use this */ platform_set_drvdata(pdev, geth); @@ -2580,8 +2592,8 @@ static int gemini_ethernet_remove(struct platform_device *pdev) { struct gemini_ethernet *geth = platform_get_drvdata(pdev); - gemini_ethernet_init(geth); geth_cleanup_freeq(geth); + geth->initialized = false; return 0; } From patchwork Wed Jul 4 18:33:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141086 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1097913ljj; Wed, 4 Jul 2018 11:37:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd2TXTBW0znYhLvyvQA+vfy5nzfq9QzdR1ZMO6MXJwJbv2Jrnmf2nlS+UR4AYpE+zGIpsYh X-Received: by 2002:a17:902:aa01:: with SMTP id be1-v6mr3139187plb.296.1530729456434; Wed, 04 Jul 2018 11:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729456; cv=none; d=google.com; s=arc-20160816; b=e1HsbuCjUpkv1q9GNqva27r3xy3M0cwBJbU7dpBXHpFi3QPS2yj8TTpAbBmvM6WbhL z4OIeAYbt4qtIfPa3DgX8OkFIsbVZYaccqfJqmNrBgCJUwHsUHOlD1+I4teibtxEl6Io z6IlWQ6vXZixQ8Itnt8hHBzH7fFysjBG3XQv/WwdlBLgKmYQzzvMy84HieW+gV8wl8ic nygDV6kiQMN3iDEwlsQTnvcPV09X7Nax1BJpGK263tNxh8gtGbXvR/QxYntTTvFzXHaO GX0/7cuACHWG4sZjIDy5ezx4r+OVnMOgInjy8c2tmCtzmi7Kwrw9Aye83vGksMKy3ZGw 8ICg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=SFI/TsSbDoXWcl6b/PQ9+szdoyT9QL5JKDZYcE5EdYY=; b=Hpfx9X6Ps3/HBvs6yb1kauKC3i6IW+gGi5/wzQP38qF1jCHdsUbIhx4GOhEHLuWQiO ZmFVBrIV05kK5OYtopTF1HvFnYj9OwyhvIThH4OQvRSeY2YS8SUj2ndU9d+Zgv8uvKIW H2dJgG13G+AYpVHUSY3q6AFAlsQs4FUWP7ul8F4Bml5raeyYXO0FzIWfDHG6zD7iYe/1 eLDU1ECWWQOFPLLYA+4JDHd6nSKE0PcBlck/mFyJ16Gl6XZkl/hehDPtJGzCiC7cOEEK DERcNsnQOLxmJ5oJ6vRcoFCOEehTW78S3JITjv+TmxLtFKaWJcaA3sAPC4+PB/eujurK cWsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WirJQwes; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si3961989pgh.569.2018.07.04.11.37.36; Wed, 04 Jul 2018 11:37:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WirJQwes; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752942AbeGDShe (ORCPT + 10 others); Wed, 4 Jul 2018 14:37:34 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40901 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752815AbeGDShc (ORCPT ); Wed, 4 Jul 2018 14:37:32 -0400 Received: by mail-lj1-f196.google.com with SMTP id a6-v6so4924841ljj.7 for ; Wed, 04 Jul 2018 11:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SFI/TsSbDoXWcl6b/PQ9+szdoyT9QL5JKDZYcE5EdYY=; b=WirJQweszjD6+YhOUv1Zsmgebgsx5Vr0oyRJLO955qQQV3xImPOYJe2/itgcVd3Y7e +vvWwZKctFn2t8KjOiuiOmfeiH9WRimmqh8Nf0K6quGms97EfTNfmShuo8IXXizPM14+ HXlOaNww+8w5IK+f9sBKv2hJgu9KZH91C764w= 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=SFI/TsSbDoXWcl6b/PQ9+szdoyT9QL5JKDZYcE5EdYY=; b=K/6W1z+HGDrt/nFN3Has5zWlsYSh6tzUypejVg3OIO2D1YAHhQqTHUmyFoWM2vZ57z 7TYrKnGnHa4J4Khgs+TAXhs1hvHqg9eB8ttv0lHbaHZQQrHn30JkFwjnHqzN3TVPB7/Z VRXnXQD7nWIlrorbfr+DuJeiyehgySM+eQhGhPXsgfdYkzTYyjc6j1mBVCcgcTdlAEZC dwYRnD4Lr3KlJIDllkly2BW5AF5+gdfx6k1D9f8Tw3BscfUR6w90TgpTc69+DBwtifQK xVqKmIvSyvjZ9LzxNzIf10Dkwl5FQyzEBWIyls6Hnv5uv+6Cv4mtY2Mv1Nrn/TN7Ev6M HOCw== X-Gm-Message-State: APt69E0r5R9iEQNjaGooHxYKCeKTexB/nbERd19Y+Ckfi+1PJuxUrjf0 ua1KQkxnq3//IyjSiTYBQM0/qXzE3bI= X-Received: by 2002:a2e:1609:: with SMTP id w9-v6mr2137650ljd.120.1530729450895; Wed, 04 Jul 2018 11:37:30 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id g2-v6sm681094ljj.53.2018.07.04.11.37.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:37:29 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 5/5 v2] net: gemini: Indicate that we can handle jumboframes Date: Wed, 4 Jul 2018 20:33:24 +0200 Message-Id: <20180704183324.10605-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704183324.10605-1-linus.walleij@linaro.org> References: <20180704183324.10605-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The hardware supposedly handles frames up to 10236 bytes and implements .ndo_change_mtu() so accept 10236 minus the ethernet header for a VLAN tagged frame on the netdevices. Use ETH_MIN_MTU as minimum MTU. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Change the min MTU from 256 (vendor code) to ETH_MIN_MTU which makes more sense. --- drivers/net/ethernet/cortina/gemini.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 4e341570047f..af38f9869734 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2476,6 +2476,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) netdev->hw_features = GMAC_OFFLOAD_FEATURES; netdev->features |= GMAC_OFFLOAD_FEATURES | NETIF_F_GRO; + /* We can handle jumbo frames up to 10236 bytes so, let's accept + * payloads of 10236 bytes minus VLAN and ethernet header + */ + netdev->min_mtu = ETH_MIN_MTU; + netdev->max_mtu = 10236 - VLAN_ETH_HLEN; port->freeq_refill = 0; netif_napi_add(netdev, &port->napi, gmac_napi_poll,