From patchwork Wed Jul 11 19:32:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141766 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp674889ljj; Wed, 11 Jul 2018 12:34:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfo/AKKb7TzGUZ7yc9w08OvmLqtUYQ8FHpNdVlmXkvQ9iEDb7dbsWduUTbqx4FKEMpwvBpg X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr7428138pfa.238.1531337694449; Wed, 11 Jul 2018 12:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337694; cv=none; d=google.com; s=arc-20160816; b=Zljyle2E9ojSbF8kvZdL06mYikT/tpwClcAxwVjHv/JQHgKgpAqMp2CTewOmu2cvkS YracfO5h/OfXHVX2LRvWkgA4W7S+wzV2xLdYIAQHu4rdQx0olJmZklqE2DFIkQ+p5Esn DOvdff234oMHIw9AMnCZFCPbYaYHE29IzPJuIimd4oSytJx42pdOZnrDZcEPi6B7aDZ/ xuFc1zcdJSwCHXJ7FaOnkCHwefOfl6XyrEYsn/LpE2RLlB37d/GeTJCEYUQJpA3BZHwU OJB2fpXg2RtUiSbomvP9NfEhqrsvLyxxNuwzcg6wx4hQdDbimNFhzu+PFCdg085Or05H Ypsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CZUb51v93n+rUDv42hpfOAOUw7nXASqVU18EbpoVEe0=; b=qoQk8KX3ksbV2yMty6sVQHZDIxhYthUyQ9d980CMLIJDp8E2xMEZiHTTV2xLv9KzS6 qKkmpSBORZfrt3rnkk5rmqn811fad1lGGqbQQmLUrb6ntoD9NRgGCnJu0w9lHg+zGZEq nj7lE+keMXmopOkmaWDYziD77IblbeWOHAEEy86uC4noDhOCpcFn56x/C+pj8zyE9xaT asU4fk0+cvW0ey1MyxN0rdAPL0OaFkdTK9u7XUe/P3udk1G+kw43NLXyTbRdoYxLbTjl 69b4I9lQjR1vlmFnQ0V5F6Zzgcb52x6UVoaCerwHh6n+pDD4znGt0vvoRrB0U3RidwtA o0ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W6Ha42Px; 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 e88-v6si21175813pfb.185.2018.07.11.12.34.54; Wed, 11 Jul 2018 12:34:54 -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=W6Ha42Px; 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 S2388269AbeGKTkk (ORCPT + 10 others); Wed, 11 Jul 2018 15:40:40 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38394 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTkk (ORCPT ); Wed, 11 Jul 2018 15:40:40 -0400 Received: by mail-lj1-f196.google.com with SMTP id p6-v6so20266781ljc.5 for ; Wed, 11 Jul 2018 12:34:51 -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:mime-version :content-transfer-encoding; bh=CZUb51v93n+rUDv42hpfOAOUw7nXASqVU18EbpoVEe0=; b=W6Ha42PxmGCKg6gYya7gQMTcY000eyIKxCSY71XASo0k8gVAm8s4bzOSI3rOry4Xsr SKnFdMFRnH2VyepnD85Z6fD7AaKvrp3BwZREGx1Q2ONx2qBhG6mYbOBGibqkdA/74wOG qANooEDFD3S9GkTxIl/FakWtI+j5SllGKcUJU= 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:mime-version :content-transfer-encoding; bh=CZUb51v93n+rUDv42hpfOAOUw7nXASqVU18EbpoVEe0=; b=M5BD8vF1bE8I3xyV6utWNlclLtkgKwmDqv4RlA1Ivo1+0z+nN4cWhIQc9Gzf9jXg+w HDOAK4lOC9/S61y32Wk3Ow0jNmeSZjOHdIsdE6Tb9nhu7uQfdYGr0HLWuhKFPulCOFXT IrnX0OSf//+Im5qTJtH8ZbXyq6o0xT/kpPSLrcXIzMWM0ihWCYJWJ0+HSgQIFlYUGhZ2 iEjSkJk4dk1ZTDYCsE8tr4kzKlI7UPIJKSlMSo/7xk4ShYLCo3w4QvQYJ00qFjaDzOkb G59KFSJoCeMJQsaDHNxHv8gIts8JuVp1mUvC/sfpVB+nxMmj7esDxFDxau2b6lVafjpk 2CAA== X-Gm-Message-State: APt69E2LVvAQy9oRPO09gB7d5Z/NJe9gWEYEevAcpnSCqJ31bVIKytQI sH6tc3eNgUl+AYbinjGVok1HBiS+zQY= X-Received: by 2002:a2e:2114:: with SMTP id h20-v6mr13932626ljh.135.1531337690335; Wed, 11 Jul 2018 12:34:50 -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 y5-v6sm5502299lfc.58.2018.07.11.12.34.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:34:49 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 1/5 v3] net: gemini: Look up L3 maxlen from table Date: Wed, 11 Jul 2018 21:32:41 +0200 Message-Id: <20180711193245.21980-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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. Acked-by: Michał Mirosław Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Collected Michał's ACK. 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 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 11 19:32:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141767 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp675950ljj; Wed, 11 Jul 2018 12:36:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenmdAmYxg0fSUd3cXS2xD/4rWItPyih2vA24RXp7TCNkcNSKZ11pHujj3ZRsQPiDqoWS9B X-Received: by 2002:a65:62d8:: with SMTP id m24-v6mr28114549pgv.307.1531337775514; Wed, 11 Jul 2018 12:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337775; cv=none; d=google.com; s=arc-20160816; b=AL2jZwIn0X7mD3y0weJYhcdcIAC9Oz+ME7YdjI4L/I0qpBgseU1SrF6nDAuaUHFYEJ 37ueo0aCZVFl+QGWqR71+cPnOXEQJg+knCkMJWER6ZpA3eADfRxM0Gn6+lIcqUV0SHOz GOyxhygNKvoQTRlVxicyeG7xZJFEIUt/s/n4jVYji4fEQVdDQmiPJowO5InA6QYLSNcr sJ6EMILaEbhwcjWRrOUIVvyMLljl4KgZfRYhrrMSRQZXGQ21T8RrQRFcYZMzHue6BggY KUsCVbhjD2CmRUhEGpHoeB+HS0OBx9Rxp64vsmsE5PZymYsj+1JjctvILVWVtmJxINbl 7iTA== 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=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=fI9pA6ZsJFVh211e7O9bgnzXHjOnFHIoss3Ig8SDofznBGQrxZsNWygZdwefu3CCCs B2viIZLELVw1LYmS1E/moCYc6W77TN+Btlb3jHt0+uFcrLT0X1Kr6Oj0PWQYHjo+TUV5 8vZp/Q3+PrKhsp0edqWabfiUglLvlx3ajRFsj8dbEdY/iPcC/iWZr2MUexLrlpfp4eYP Qk2teNi7GHUyh4ZmxMZgTOO+IBnmS0gHTOHF+brluJfZs1QaHvyrUY0CjbNJRoxd7X3o B1JYc4doCqqyZR4ayDEAtzjbAJ4xfxu21XBeHbSyVMlJmqzJ1AQQvXkl0yLKs3lzSBFu DhDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHKFNuna; 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 85-v6si21344993pfm.264.2018.07.11.12.36.15; Wed, 11 Jul 2018 12:36:15 -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=GHKFNuna; 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 S2388321AbeGKTmB (ORCPT + 10 others); Wed, 11 Jul 2018 15:42:01 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:40068 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTmB (ORCPT ); Wed, 11 Jul 2018 15:42:01 -0400 Received: by mail-lf0-f68.google.com with SMTP id y200-v6so22218205lfd.7 for ; Wed, 11 Jul 2018 12:36:11 -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=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=GHKFNuna9Vz2bdcBkbH+V+Rq9d5epKeIDuFlzyCI40QEn5wgJOjziZxVA8MNckiV2b 9iZ51jGvGArXkta4KwbHuwKn7nD+Ay6LA+EqtmA23Dv6u0X95QLtlOA6YKR+QfbIRdYN rXi9Dmqyb6LtqbAaI2Jzb3aObsqyHw+XVauGk= 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=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=qC5rEuGMXVMSNo6c1VlCB5gN3l5rCpPLl7JQqxdgyFfDFgegoRNV7wj1WZH6x7AM4o ku3m6Ld1Mo3VRXbUua5yCVZ9yRD2/LHOa2nEojSrOJmYcAjDTsnCpOvaGVd2TYwszY5a GqUT7TYOy6QOSfbxI74Gk0wXLkavjYw/QGFWpiQdh70ya6bJX4+XGrnyUWCf1VU2yCT6 6X1u3MqbM98rkoWMXBVbIEljnvA1abauW5mKbGDtp1fhx9R8lQS+K5puJy5IqvZ4V+YH GxxVdlVdDGsvCM3rXybYSboRANiiwTaux55qTHmNXfLQ5P1Lcx0xD0j4kbeHyqpskqop JYOQ== X-Gm-Message-State: APt69E14VOJtZr57JLAxhsTmB4QlzCr0fUlfk+YGx09VShjjX88EJa5c j4OqJP1ovwiiHEuKjNE+BT/kUHzH05k= X-Received: by 2002:a19:1586:: with SMTP id 6-v6mr6524990lfv.51.1531337770824; Wed, 11 Jul 2018 12:36:10 -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 y5-v6sm5502299lfc.58.2018.07.11.12.36.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:36:09 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 2/5 v3] net: gemini: Improve connection prints Date: Wed, 11 Jul 2018 21:32:42 +0200 Message-Id: <20180711193245.21980-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180711193245.21980-1-linus.walleij@linaro.org> References: <20180711193245.21980-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. The phy_print_status() was already in place, albeit never really used because the debuglevel hiding it had to be set up using ethtool. Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Use phy_attached_info() live all other drivers. - Put it in an if (netif_msg_link()) clause like the other message from phy_print_status(). - Explain more in the commit message. 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 | 46 +++++++++++++++------------ 1 file changed, 26 insertions(+), 20 deletions(-) -- 2.17.1 Reviewed-by: Andrew Lunn diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 8fc31723f700..f0ab6426daca 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,12 +371,6 @@ 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)); - phy->supported &= PHY_GBIT_FEATURES; phy->supported |= SUPPORTED_Asym_Pause | SUPPORTED_Pause; phy->advertising = phy->supported; @@ -376,19 +378,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"); @@ -398,6 +400,9 @@ static int gmac_setup_phy(struct net_device *netdev) } writel(status.bits32, port->gmac_base + GMAC_STATUS); + if (netif_msg_link(port)) + phy_attached_info(phy); + return 0; } @@ -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 11 19:32:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141768 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp675990ljj; Wed, 11 Jul 2018 12:36:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc4v12+SGdNTCKkMjhapQM0RjJSk7ageQOR6A6nDCGiR+usj0U5hzE009wVXD9ThFeion5k X-Received: by 2002:a62:c505:: with SMTP id j5-v6mr7242961pfg.153.1531337778006; Wed, 11 Jul 2018 12:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337778; cv=none; d=google.com; s=arc-20160816; b=awSk7rLV+27t2Pi94d9JU+dHx5agcrklDyBCxXlGRqxAzfx/EspCE6enb/EDBn21Pq AR2QpdSyKCp5ibjUhvtv6rohLusNBebswrKcK3vImH5QZ0B0DYzMxlvBL/JV/UFLm+KO KIik3ahybrYhFhsnrANpQVrl2jIijZ19+6BJpYfEPAs5yD6Vb82p/1ml6bUsYZCRoti5 11l4DJsFvxH2iVJWID40O9LGV5R+XSiI1jmV0TvOpV8c4R59bkk1RgAp+tZnV1utmoaZ pdN1N7t0AmB3OPEslP4FrOiXe6AtYBjabypO223NyO2OqicmofcJK7bFerD+q2VM+Z3Z xoDQ== 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=LpgAKbHTu/H1aGrfb5s3js5+h9rRQAfrwcPR6GXVOnM=; b=0NyvXNuXxyGg3eOT5r/V1Egnf4JV+CcQvAQK7drWFzcbtYbxkAw0pUKXrRoorBnSmh LUPW4WBb/VmE1NHQn/7dj7g93d5rWWfVmmui+Ogw4jBWf71qN/XcQinFECKDHbavpZzd GlyCWVmqnNgZ7dl+5vjUWttPGMhwXfK/oJ+yoVcaME19rUlDvyks3sZRf6tQ27yGXW3c ERg0fcPhkJVYtwCjxgjQvLbSUOm43TtQgaT5axLuAYAf+jdShtaNn9txU7imUWfc2qn/ 5W3lvELbqIlvRZoDYcvbtx9aYC7NKLNAJR8huOBUSfzNipm85B9KtsD++i4RJjIgtg2h ru+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XeFA3jJ8; 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 85-v6si21344993pfm.264.2018.07.11.12.36.17; Wed, 11 Jul 2018 12:36:17 -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=XeFA3jJ8; 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 S2388343AbeGKTmE (ORCPT + 10 others); Wed, 11 Jul 2018 15:42:04 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44775 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTmD (ORCPT ); Wed, 11 Jul 2018 15:42:03 -0400 Received: by mail-lf0-f65.google.com with SMTP id g6-v6so11511601lfb.11 for ; Wed, 11 Jul 2018 12:36:14 -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=LpgAKbHTu/H1aGrfb5s3js5+h9rRQAfrwcPR6GXVOnM=; b=XeFA3jJ8RTQMmuPlez3EvDhCWknfXX4ijVB1KFGuC7PnDlSMXIqIdqeAm1kH0Jeavo bAXWTD5Y4tDNlNKpKqbrV02AGvC5hKFIqVhW48q/HbgKmrZ1CNI29VbL/vepmvNFBu8V +Zhu5bnwqlrvEfLopjIEmGeihbU7OWIIDjVu8= 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=LpgAKbHTu/H1aGrfb5s3js5+h9rRQAfrwcPR6GXVOnM=; b=C0SG8UsoR45EP/9YKyG7fAQwAViJSDuMZswBi/hufWLa/EhMx+r2Oxw8Dz3JPG9fJQ DnRbPEAA0V2ppUZW0PttnVuPNPEPCup2PYiZPIzexkY4an1Kjn+Q8WUjo/lUsZtXz4UG bUnKI7Fi3e6Kkb1LKr8QS6ts3hog6hwQxjaIssWggQuwiw1K7iJaqRsHTduX/AOpHzUJ UU8hO2XOC9y9R7PmvJfjUMu66w76OKV0JXiOxUglj9RkPSIAzqYlNK1nwwbytPvnxVoq KW8ZcHLNjCyXg9KzyJkSH5cZWAxsWJAgiLuDEuo5N+W2e1hiiyxcOPBiCLwg8EnzfKTR ZWtw== X-Gm-Message-State: APt69E0YFe5CLxqgsbuKIKfIDrfkISaQw8c8G8rhPg4S69UhGQEnZxzk CxCaG8lUYIbKf3SPJyQ2K0aEZCk+5ws= X-Received: by 2002:a19:4e06:: with SMTP id c6-v6mr6615236lfb.30.1531337773450; Wed, 11 Jul 2018 12:36:13 -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 y5-v6sm5502299lfc.58.2018.07.11.12.36.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:36:12 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 3/5 v3] net: gemini: Allow multiple ports to instantiate Date: Wed, 11 Jul 2018 21:32:43 +0200 Message-Id: <20180711193245.21980-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180711193245.21980-1-linus.walleij@linaro.org> References: <20180711193245.21980-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 v2->v3: - No changes, just resending with the rest. 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 f0ab6426daca..2457a1239d69 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 11 19:32:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141769 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp676016ljj; Wed, 11 Jul 2018 12:36:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeLkaskelJPHhbCEaLnJwfsquI617CMjmRNwbkBLRzri3CPuZB36b/iapv5/P00H+hzaY7f X-Received: by 2002:aa7:850b:: with SMTP id v11-v6mr30846847pfn.165.1531337780332; Wed, 11 Jul 2018 12:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337780; cv=none; d=google.com; s=arc-20160816; b=zdiesTbOMa9js+6MmbKz5HUnW8LyQ6aGvf4GoW7fDueH3agT7mc6NDr9K6n92emuNU m4P34lbl8EhISsz1zSLr5ud07Ej5fogdSb50VL0uj0pyO/A116jHbnJoNn/Yja6K9xi+ zGkiNOhuevpZwXsHozTjgZ2/3Qtv8pOYFtsguaTEqGrFC/QHDiFXWdAXalIhKGV1Rz36 Lsfz22x1R4eN1VmX/Knn8eCltGmaJ39MCKjgU6Mr/p8AvcsbQQ/h1cOvVrbMcGTqptGP M5BjklxqmXMCa/BZZDjOnShw++ISj1Ij7oYNG0JMlKo6VIqG5BjsuokIHqjqfI/q0yTe DQEw== 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=pl+I3Y1OKFfxSy/bu96YlYHYtgheJ6HfhI3du4hNUCQ=; b=wiH2n6I3fZRZvBiB6RHY5G0zyslyQ6d+epoLOdbmP9DzPwSzetqfDSV9kKG9ch6kNy J/2SxcAkc7ZvivvPUVkjx+wVXbI/Ur0OeOwRksg84Qp5SxJVHseAaDyrzcSoJsLY1Aba pHSaTJYFQsFCix2qJB7BmynIiKkmGN8lRSZkc6yVRW+FyOcHR6grNE7wlN68oT1AKhyt sX2ZbiZgXOmK9Sk7NFmNjtZD0WfK8eZDyg/0mpawekyhySGYca+zHrAlpOv4b0nTE6Lk 8gerTO1alhhS9hxMbrOI4Zey+HwTDX17aMSI2A3cHSo7CBRANGVcGUmOd+3tcRhYpvwl ON0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i+nh/7tu"; 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 85-v6si21344993pfm.264.2018.07.11.12.36.20; Wed, 11 Jul 2018 12:36:20 -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="i+nh/7tu"; 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 S2388375AbeGKTmG (ORCPT + 10 others); Wed, 11 Jul 2018 15:42:06 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38356 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTmG (ORCPT ); Wed, 11 Jul 2018 15:42:06 -0400 Received: by mail-lf0-f67.google.com with SMTP id a4-v6so22217072lff.5 for ; Wed, 11 Jul 2018 12:36:17 -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=pl+I3Y1OKFfxSy/bu96YlYHYtgheJ6HfhI3du4hNUCQ=; b=i+nh/7tuNZclV1YvoGeNltWSjanzZiT7dAIBM6017D8/CdmmgxAoYtnmk1qcQdhnP6 S3QEsNyBJ9P2Fh1eeawInjzAUOhyzLi4m0PkAmPlG/c7Q8a3edsxEqfb8fBEVgVFtF4T /UjG6AklFjWPv7GqE4aqsG6CUrdUDH3YavsqI= 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=pl+I3Y1OKFfxSy/bu96YlYHYtgheJ6HfhI3du4hNUCQ=; b=EgAzU+phJpwmgWFYeXYieFCbzIYABJkWJoOnHRncZhsCvWZMvfx9g+3eJ4rg8SCvbr lDoQI+C4hoNKRlXvqw0QK+4a1qmXHa+fXIFwmJkXXtp3BtOSPW3zrp3WQ9iMQQgWQjZD FmAjFEzNanv1Yp8D235cl5/L9qz9WW9nlOwOaTqEDqN4abzbuAj+tTwaJZrKA4vGvPvz GG1joiFSAYadyAImcni5L+cVHOpi4LAIQQjj1Is+GEqKNvholGDnm1FUvqUWHHpZdOf5 DkvaUhq4wekpoNCBuN7IGv3iVzud6kaemhbiLaHBwTM66w+oeBrvMxGxi2xZtjN4oiMF esGQ== X-Gm-Message-State: APt69E1gmU1bAwTspEOL1zHV1cGqhzFSYkBaZUdXxMxXvAjdd6ilw8sM kn13JBekZejmMe8SC+x0MJCH9i5iav0= X-Received: by 2002:a19:c954:: with SMTP id z81-v6mr6570871lff.107.1531337776258; Wed, 11 Jul 2018 12:36:16 -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 y5-v6sm5502299lfc.58.2018.07.11.12.36.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:36:15 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 4/5 v3] net: gemini: Move main init to port Date: Wed, 11 Jul 2018 21:32:44 +0200 Message-Id: <20180711193245.21980-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180711193245.21980-1-linus.walleij@linaro.org> References: <20180711193245.21980-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 v2->v3: - No changes, just resending with the rest. 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 2457a1239d69..0f1d26441177 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 11 19:32:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141770 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp676061ljj; Wed, 11 Jul 2018 12:36:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdyfTvUFuHO543B1xARljgyxh9B5Q25QvGch1nxZng4kAOX3XodWvoCZyYazj9ya5Nk+BF0 X-Received: by 2002:a17:902:4d:: with SMTP id 71-v6mr29969743pla.317.1531337783215; Wed, 11 Jul 2018 12:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337783; cv=none; d=google.com; s=arc-20160816; b=QaxPrVz1+cckK1U1NLIzDSgXrriELS9+TmhGdpYJIoyHZUR+C3XTnE64b0c/yam5E+ USfW40SN0AUiFPUsY5nBG0Q0Idt8+ntuS/q3xbwf3+sD047UH69agY2sscFNH/3BBKsS Fg30XnET6maO5huylNaCE7SXN3ZIAaTsQq4xS+SOsDaMixNMewJ01KHy1OTh+THeh5/q gYuhrAruWIXCJdmcGq0cRq9OcB0J4o29Rz3wnhySvkmsOafdtbtR0sMmyxNiyZDLl7IC e1YtK9sIzP6MJjLj4g1Z4VIgumuZfUrWUTw/rSarLADy44xR1Al3bcOKlDGlD0a712Hu aS1w== 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=DX3mhXvM3mnS/LvEcn2vPGDW+AztgpDhIezs1Gc0iZo=; b=pSF7bOgr/XfR0XI5OcHlyYnlMV8z0bTssPowasScvlpWP5eRFtHK3jrdUByIqTqm0X 6sxAahH9AiEO1eRi2VEv/qUX9tD9h68w1Izugy0oqPQEgvSyO0b/4f2Imnir0SEDjoF+ j79cifilWU5Y9IkhoiHnswuKxj1BG6q9byKf1/jHSYzUTcfhiWcDO7ZncdCCGa9iXfQj qs6ddCG7tob6FwK03eSCMxj3mp5jjeWgxV1JJafxQ/zq37+kBOr3UXQAn1sHlhTO8eBa 5EBRaKXzJw9zODVshnGd9PTlhuCTNFENTag884/DkJfWkbE34cBo47nhVP6l5c0wVsCP OK5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsWJzot5; 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 85-v6si21344993pfm.264.2018.07.11.12.36.23; Wed, 11 Jul 2018 12:36:23 -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=LsWJzot5; 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 S2388445AbeGKTmJ (ORCPT + 10 others); Wed, 11 Jul 2018 15:42:09 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35957 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTmJ (ORCPT ); Wed, 11 Jul 2018 15:42:09 -0400 Received: by mail-lj1-f194.google.com with SMTP id u7-v6so17614549lji.3 for ; Wed, 11 Jul 2018 12:36:20 -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=DX3mhXvM3mnS/LvEcn2vPGDW+AztgpDhIezs1Gc0iZo=; b=LsWJzot53MSwwOO7Q5DirsjaydOaQrxEIR6tRWb+r12fRJeJjYxJ0FIOeNme4tOzCu D2qGiXcePqkzHkLBwexuknlDdRG5pKpYNyg+aIQ5pmA6WfX6mYvRPVpNX+cIQJ059xV6 ZcZtIcuspBbcolfr2el8F4s6qjsEtJYnVyO/Y= 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=DX3mhXvM3mnS/LvEcn2vPGDW+AztgpDhIezs1Gc0iZo=; b=fvckUkeHg5nXfTGcZirJFT25AVWBdLy6fnIheXTUtVTc1LPvxxS+ImUaGOU0J3IboM tFQX5mlFPtH3JWLTYWgRGzB03WZSXb/bsMXnZ3zNiuX77qbq8wtGufmUn5hmgUSj9KP+ g9N9bc74s/T4wGxI7HCfggJeKuItjTL9hBfVlq6sjyG/9/5GzBU11WuVI6d8p7YL1z4M ZhoP4XPLVN2TVg5vQ8243x9fO+g5K6M3ho8miRus6b6mBOzfExliyGtXm6weCorEfAUh KMsJFMIwNdi+MZIq6+bLcXvKv7TJqmvhNryC3+sYXpyXawbHR350vuCHdG3iD+5VpULF tD2g== X-Gm-Message-State: APt69E0MiHh8JEtHdRVFFZ2uzlJ/4VfwcHRXCoJF9DocmZLoeFixmn4X 9QbAgm/Tb0i4fW5o5HYXEBqSDHILAH0= X-Received: by 2002:a2e:9095:: with SMTP id l21-v6mr8014758ljg.15.1531337778827; Wed, 11 Jul 2018 12:36:18 -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 y5-v6sm5502299lfc.58.2018.07.11.12.36.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:36:17 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 5/5 v3] net: gemini: Indicate that we can handle jumboframes Date: Wed, 11 Jul 2018 21:32:45 +0200 Message-Id: <20180711193245.21980-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180711193245.21980-1-linus.walleij@linaro.org> References: <20180711193245.21980-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 v2->v3: - No changes, just resending with the rest. 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 Reviewed-by: Andrew Lunn diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 0f1d26441177..22f495b490d4 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,