From patchwork Mon Mar 16 19:31:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 222449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA38EC3F2CE for ; Mon, 16 Mar 2020 19:31:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EE6C20674 for ; Mon, 16 Mar 2020 19:31:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="oyUAyALl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732449AbgCPTbp (ORCPT ); Mon, 16 Mar 2020 15:31:45 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37892 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732429AbgCPTbp (ORCPT ); Mon, 16 Mar 2020 15:31:45 -0400 Received: by mail-pg1-f195.google.com with SMTP id x7so10296857pgh.5 for ; Mon, 16 Mar 2020 12:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YFwdwokeovEZ2zjrRaZ7T7a+UD0PdDiAfN6gx/7xgTo=; b=oyUAyALlXn7nqeQtperRXOrqmsCStal1U8XZFW+Hra1ipX5bc2zlePjiRP3/2Gn2QB LQZ3sE9y88M4BF6eXdHlW6K5LjkogqLJjfAC3+J/JfIW/sVPVm3wYRSaBaQxktCOD3ty CIDbVmmJ4nSOaZs2suFFyVqvC4kzlbxJpNuSQkoShMiTUs/hN53qFtab47NqdSFeiFuf rJZcDJU/1/htbdRQi3CFoZZbmpe2q2RRommhRD4rFbKaIEpnyBbIIZA22YbR9SNPvmdr b4i2OcpMgx7fkg+S35XkDt5ZWiNPaSITfXRXQQzHqzj9Sj4bHtjfi7n6PwL+AeJoEcnI 9xBw== 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=YFwdwokeovEZ2zjrRaZ7T7a+UD0PdDiAfN6gx/7xgTo=; b=p6pfzawgO98lbnZGm6NSm/wf0R7f++eIaavbrTDCkk8aRkqa6wlJA0ldbEarupYQKD otZkiNqllgxlnTONLyhuwm9jgGu5Z9MBm/RIsugGANgjmSOys0AwgkZYab3XXh1blC96 GpXfdxBKEShk82RfpY+FuSFGMg2EH0g1EiFec5ENwEXxH+TjNIT+CPBdyKYch2WydQgS 3awtAq742MPwU693d+NPoEdePpXA6G2G3F7zZ4Asa1BZF6zysQnafVNTrauvpyenSPQ4 pnfYAjJXWyb2llQVCjHxuzD6xKxeB9OUL/Sv/grnQfdaxYiDKRkfrh5N7wEAPQyjI177 CWbA== X-Gm-Message-State: ANhLgQ2ezAefrlyCTZiLUflYLjAcxADTe1deTUsELuxVEbQigft70K6r R82b9+b8GkMtV14PrpFDSRI8MwuveI0= X-Google-Smtp-Source: ADFU+vvIabp4ZAGjhR6+TSGY2pdBQgmfwHCz2H0wWtlSTj+m5XuVrvCju5PJJAImQaJNvemrQFiC8Q== X-Received: by 2002:a63:7a02:: with SMTP id v2mr1289044pgc.13.1584387102575; Mon, 16 Mar 2020 12:31:42 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id w17sm656413pfi.59.2020.03.16.12.31.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2020 12:31:42 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH v2 net-next 1/5] ionic: stop devlink warn on mgmt device Date: Mon, 16 Mar 2020 12:31:30 -0700 Message-Id: <20200316193134.56820-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200316193134.56820-1-snelson@pensando.io> References: <20200316193134.56820-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If we don't set a port type, the devlink code will eventually print a WARN in the kernel log. Because the mgmt device is not really a useful port, don't register it as a devlink port. Fixes: b3f064e9746d ("ionic: add support for device id 0x1004") Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_devlink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c index ed14164468a1..273c889faaad 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c @@ -77,12 +77,16 @@ int ionic_devlink_register(struct ionic *ionic) return err; } + /* don't register the mgmt_nic as a port */ + if (ionic->is_mgmt_nic) + return 0; + devlink_port_attrs_set(&ionic->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, 0, false, 0, NULL, 0); err = devlink_port_register(dl, &ionic->dl_port, 0); if (err) dev_err(ionic->dev, "devlink_port_register failed: %d\n", err); - else if (!ionic->is_mgmt_nic) + else devlink_port_type_eth_set(&ionic->dl_port, ionic->master_lif->netdev); @@ -93,6 +97,7 @@ void ionic_devlink_unregister(struct ionic *ionic) { struct devlink *dl = priv_to_devlink(ionic); - devlink_port_unregister(&ionic->dl_port); + if (ionic->dl_port.registered) + devlink_port_unregister(&ionic->dl_port); devlink_unregister(dl); } From patchwork Mon Mar 16 19:31:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 222448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A67FC0044D for ; Mon, 16 Mar 2020 19:31:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D3BB20674 for ; Mon, 16 Mar 2020 19:31:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="O1+sePdN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732466AbgCPTby (ORCPT ); Mon, 16 Mar 2020 15:31:54 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:39548 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732452AbgCPTby (ORCPT ); Mon, 16 Mar 2020 15:31:54 -0400 Received: by mail-pj1-f67.google.com with SMTP id d8so9214362pje.4 for ; Mon, 16 Mar 2020 12:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pxzxeuq/DgFqe2dlBw1W/2xnLEJ/0TSO3oRKDopVtE4=; b=O1+sePdNAdHKxaeoM12HDL/N0ugk1dUSGDlhUpjnFDnBOzPxkqAQHtIQeAkb89Un5h uPRqLDbTcyFWLnYOqYuNsp+zHK6MUL9c8BRTp571od6z4LpNHfE0UuXVWcSYi8iikkqJ NSk8C8lUT5ux4Xx8FmTTCKvnIZWcY67yb3R9T9yjEPgZc2fUeYyi1yFk7FNUYAJfebvg IgT2vqnZVtZuzhPXCj4Vt1M2PiHsM6PeCY2IInOftGXZ1cAPnJXl3Y6O2WZIC4r3nUde atJEaUWh13iphuKC6AZvVfjpvIqEk58IdK8hQMxjKCuWEpSkRIXyCQyixyco/NoMN+nu 66jQ== 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=Pxzxeuq/DgFqe2dlBw1W/2xnLEJ/0TSO3oRKDopVtE4=; b=EkVDm9TNXojNDq70cBr7gy6a66asW2QcqiPsu1/wq3vaiAx2D5UnxUuTtvQMm/uMdl REhRf/2xjqaeQRont0inWbxs19Hvw0FyS+iURE/Jqvj4Nytqk2D+1RiN9h8+EBqXJqvT zgrzEpWMLfQjpB65Btc8AMr/YjeJmp2/OrPDLjRn8/p3szzM6gtVPo+bc0W1HvrXRn7M JK0/fvdk4oeK9UfA5ryEXfKq2kEyen/iXuFJckQIwqT/6ULXGOly/KMxTqyHgYn+PVc6 EzcB8UN4ndkUW6EYupStiJMfWLK3kjyvJ1Y3tRUmX3DHn/Pj0HeGA9R9vjPE6R657axE JZ5w== X-Gm-Message-State: ANhLgQ2K26dGCWAInZVTi8YZ1QpT3a23H9Nhenkd+3PScCN4DVSug1hR ZirFYGWp8akt/qBQyHhWJ+AuONZYA1c= X-Google-Smtp-Source: ADFU+vt7zNNfLeMOAMGuqwBgNQUIyexNmB2tzQ9AoS6YaxwSc5fdh0Vez0/raJWyvTlQr4OsIDKM1g== X-Received: by 2002:a17:90a:dac6:: with SMTP id g6mr1169170pjx.30.1584387107793; Mon, 16 Mar 2020 12:31:47 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id w17sm656413pfi.59.2020.03.16.12.31.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2020 12:31:46 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH v2 net-next 4/5] ionic: return error for unknown xcvr type Date: Mon, 16 Mar 2020 12:31:33 -0700 Message-Id: <20200316193134.56820-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200316193134.56820-1-snelson@pensando.io> References: <20200316193134.56820-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If we don't recognize the transceiver type, return an error so that ethtool doesn't try dumping bogus eeprom contents. Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support") Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index a233716eac29..3f92f301a020 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -694,7 +694,7 @@ static int ionic_get_module_info(struct net_device *netdev, default: netdev_info(netdev, "unknown xcvr type 0x%02x\n", xcvr->sprom[0]); - break; + return -EINVAL; } return 0; @@ -714,7 +714,19 @@ static int ionic_get_module_eeprom(struct net_device *netdev, /* The NIC keeps the module prom up-to-date in the DMA space * so we can simply copy the module bytes into the data buffer. */ + xcvr = &idev->port_info->status.xcvr; + switch (xcvr->sprom[0]) { + case 0x03: /* SFP */ + case 0x0D: /* QSFP */ + case 0x11: /* QSFP28 */ + break; + default: + netdev_info(netdev, "unknown xcvr type 0x%02x\n", + xcvr->sprom[0]); + return -EINVAL; + } + len = min_t(u32, sizeof(xcvr->sprom), ee->len); do {