Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-03-20 15:17:03 +0100
committerMichal Suchanek <msuchanek@suse.de>2019-03-20 15:17:03 +0100
commit434702917ae7264823d25fbf159beab262153abe (patch)
treed0f3c580bbb5e0d071fbd48d9a57b01ab6837f82
parentd6e5008b5ea28c5fa285e31739e49b84bc14b174 (diff)
ibmvnic: Report actual backing device speed and duplex values
(bsc#1129923).
-rw-r--r--patches.drivers/ibmvnic-Report-actual-backing-device-speed-and-duple.patch195
-rw-r--r--series.conf3
2 files changed, 198 insertions, 0 deletions
diff --git a/patches.drivers/ibmvnic-Report-actual-backing-device-speed-and-duple.patch b/patches.drivers/ibmvnic-Report-actual-backing-device-speed-and-duple.patch
new file mode 100644
index 0000000000..5ddcb5196e
--- /dev/null
+++ b/patches.drivers/ibmvnic-Report-actual-backing-device-speed-and-duple.patch
@@ -0,0 +1,195 @@
+From f8d6ae0d27ec1e81e4be454e63bc96086bbf8e6b Mon Sep 17 00:00:00 2001
+From: Murilo Fossa Vicentini <muvic@linux.ibm.com>
+Date: Tue, 19 Mar 2019 10:28:51 -0300
+Subject: [PATCH] ibmvnic: Report actual backing device speed and duplex values
+
+References: bsc#1129923
+Patch-mainline: queued
+Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
+Git-commit: f8d6ae0d27ec1e81e4be454e63bc96086bbf8e6b
+
+The ibmvnic driver currently reports a fixed value for both speed and
+duplex settings regardless of the actual backing device that is being
+used. By adding support to the QUERY_PHYS_PARMS command defined by the
+PAPR+ we can query the current physical port state and report the proper
+values for these feilds.
+
+Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
+Signed-off-by: Murilo Fossa Vicentini <muvic@linux.ibm.com>
+Reviewed-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c | 93 ++++++++++++++++++++++++++----
+ drivers/net/ethernet/ibm/ibmvnic.h | 18 ++++--
+ 2 files changed, 94 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
+index 5ecbb1adcf3b..25b8e04ef11a 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -120,6 +120,7 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *);
+ static void release_crq_queue(struct ibmvnic_adapter *);
+ static int __ibmvnic_set_mac(struct net_device *netdev, struct sockaddr *p);
+ static int init_crq_queue(struct ibmvnic_adapter *adapter);
++static int send_query_phys_parms(struct ibmvnic_adapter *adapter);
+
+ struct ibmvnic_stat {
+ char name[ETH_GSTRING_LEN];
+@@ -2278,23 +2279,20 @@ static const struct net_device_ops ibmvnic_netdev_ops = {
+ static int ibmvnic_get_link_ksettings(struct net_device *netdev,
+ struct ethtool_link_ksettings *cmd)
+ {
+- u32 supported, advertising;
++ struct ibmvnic_adapter *adapter = netdev_priv(netdev);
++ int rc;
+
+- supported = (SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg |
+- SUPPORTED_FIBRE);
+- advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg |
+- ADVERTISED_FIBRE);
+- cmd->base.speed = SPEED_1000;
+- cmd->base.duplex = DUPLEX_FULL;
++ rc = send_query_phys_parms(adapter);
++ if (rc) {
++ adapter->speed = SPEED_UNKNOWN;
++ adapter->duplex = DUPLEX_UNKNOWN;
++ }
++ cmd->base.speed = adapter->speed;
++ cmd->base.duplex = adapter->duplex;
+ cmd->base.port = PORT_FIBRE;
+ cmd->base.phy_address = 0;
+ cmd->base.autoneg = AUTONEG_ENABLE;
+
+- ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
+- supported);
+- ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
+- advertising);
+-
+ return 0;
+ }
+
+@@ -4278,6 +4276,73 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq,
+ }
+ }
+
++static int send_query_phys_parms(struct ibmvnic_adapter *adapter)
++{
++ union ibmvnic_crq crq;
++ int rc;
++
++ memset(&crq, 0, sizeof(crq));
++ crq.query_phys_parms.first = IBMVNIC_CRQ_CMD;
++ crq.query_phys_parms.cmd = QUERY_PHYS_PARMS;
++ init_completion(&adapter->fw_done);
++ rc = ibmvnic_send_crq(adapter, &crq);
++ if (rc)
++ return rc;
++ wait_for_completion(&adapter->fw_done);
++ return adapter->fw_done_rc ? -EIO : 0;
++}
++
++static int handle_query_phys_parms_rsp(union ibmvnic_crq *crq,
++ struct ibmvnic_adapter *adapter)
++{
++ struct net_device *netdev = adapter->netdev;
++ int rc;
++
++ rc = crq->query_phys_parms_rsp.rc.code;
++ if (rc) {
++ netdev_err(netdev, "Error %d in QUERY_PHYS_PARMS\n", rc);
++ return rc;
++ }
++ switch (cpu_to_be32(crq->query_phys_parms_rsp.speed)) {
++ case IBMVNIC_10MBPS:
++ adapter->speed = SPEED_10;
++ break;
++ case IBMVNIC_100MBPS:
++ adapter->speed = SPEED_100;
++ break;
++ case IBMVNIC_1GBPS:
++ adapter->speed = SPEED_1000;
++ break;
++ case IBMVNIC_10GBP:
++ adapter->speed = SPEED_10000;
++ break;
++ case IBMVNIC_25GBPS:
++ adapter->speed = SPEED_25000;
++ break;
++ case IBMVNIC_40GBPS:
++ adapter->speed = SPEED_40000;
++ break;
++ case IBMVNIC_50GBPS:
++ adapter->speed = SPEED_50000;
++ break;
++ case IBMVNIC_100GBPS:
++ adapter->speed = SPEED_100000;
++ break;
++ default:
++ netdev_warn(netdev, "Unknown speed 0x%08x\n",
++ cpu_to_be32(crq->query_phys_parms_rsp.speed));
++ adapter->speed = SPEED_UNKNOWN;
++ }
++ if (crq->query_phys_parms_rsp.flags1 & IBMVNIC_FULL_DUPLEX)
++ adapter->duplex = DUPLEX_FULL;
++ else if (crq->query_phys_parms_rsp.flags1 & IBMVNIC_HALF_DUPLEX)
++ adapter->duplex = DUPLEX_HALF;
++ else
++ adapter->duplex = DUPLEX_UNKNOWN;
++
++ return rc;
++}
++
+ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
+ struct ibmvnic_adapter *adapter)
+ {
+@@ -4426,6 +4491,10 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
+ case GET_VPD_RSP:
+ handle_vpd_rsp(crq, adapter);
+ break;
++ case QUERY_PHYS_PARMS_RSP:
++ adapter->fw_done_rc = handle_query_phys_parms_rsp(crq, adapter);
++ complete(&adapter->fw_done);
++ break;
+ default:
+ netdev_err(netdev, "Got an invalid cmd type 0x%02x\n",
+ gen_crq->cmd);
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
+index f2018dbebfa5..d5260a206708 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.h
++++ b/drivers/net/ethernet/ibm/ibmvnic.h
+@@ -377,11 +377,16 @@ struct ibmvnic_phys_parms {
+ u8 flags2;
+ #define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
+ __be32 speed;
+-#define IBMVNIC_AUTONEG 0x80
+-#define IBMVNIC_10MBPS 0x40
+-#define IBMVNIC_100MBPS 0x20
+-#define IBMVNIC_1GBPS 0x10
+-#define IBMVNIC_10GBPS 0x08
++#define IBMVNIC_AUTONEG 0x80000000
++#define IBMVNIC_10MBPS 0x40000000
++#define IBMVNIC_100MBPS 0x20000000
++#define IBMVNIC_1GBPS 0x10000000
++#define IBMVNIC_10GBP 0x08000000
++#define IBMVNIC_40GBPS 0x04000000
++#define IBMVNIC_100GBPS 0x02000000
++#define IBMVNIC_25GBPS 0x01000000
++#define IBMVNIC_50GBPS 0x00800000
++#define IBMVNIC_200GBPS 0x00400000
+ __be32 mtu;
+ struct ibmvnic_rc rc;
+ } __packed __aligned(8);
+@@ -999,6 +1004,9 @@ struct ibmvnic_adapter {
+ int phys_link_state;
+ int logical_link_state;
+
++ u32 speed;
++ u8 duplex;
++
+ /* login data */
+ struct ibmvnic_login_buffer *login_buf;
+ dma_addr_t login_buf_token;
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index c9df2307d2..d6d548525f 100644
--- a/series.conf
+++ b/series.conf
@@ -20950,6 +20950,9 @@
patches.fixes/9p-net-fix-memory-leak-in-p9_client_create.patch
patches.fixes/perf-x86-intel-fix-memory-corruption.patch
+ # davem/net-next
+ patches.drivers/ibmvnic-Report-actual-backing-device-speed-and-duple.patch
+
# dhowells/linux-fs keys-uefi
patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch
patches.suse/0002-efi-Add-EFI-signature-data-types.patch