Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3240089pxv; Mon, 12 Jul 2021 12:36:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYdL3rulmNTY+CYMscWa1NcD5gfhYDm1+sDQyFW9TgIX/pWA9Xp5ZL5Ig+JrNVjE3qAY4y X-Received: by 2002:a05:6402:1615:: with SMTP id f21mr569015edv.35.1626118609925; Mon, 12 Jul 2021 12:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626118609; cv=none; d=google.com; s=arc-20160816; b=HCZO4Wloq5Gh74XabQJNe6ulfMM8StxclbzZ+3dcmp534AQgxNyuZ2x8cIUoPKcR1W qHGKM142ubjJjaMUV7UE14Sbsd+GlRwkg5HhMAfLqv6ZbLFNpX+yxHivksNFX+FwsRB6 RshNfePbfBhwj8XRXiIcTII2eDFlF3TByHTEI6UtwK+9GIexrVkpt6p8rNFfi/e3AbrM AvHLFYrMnSC5Hu6PnmOTkkmqCMmiI/skmfTn44Syh1unqOl97KH5ZHarHftSASjllJ6a 7DtMeb14Q6M4vZpmmEcI5vpM2O8W0dzx+3RAhMJ8VV3fvDtBVYUZZyzcaIYdQrwvO0e2 4y2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :organization:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=QvtW3FBa9tE1mwfOAdgXsMj45z9JyERAMcNsH2N1onA=; b=ejW01xS65tHpPsIFow+SpxWEu6VPduNa+BhKmmqNTn4/4CtLeSzmX5hbMYeOrC0FlH HlNxyuKkSPOjkgT/1ajwQHzv98JUw33L+kEDF6nRw1q48ijTZWAuCRZnkLIuOfJjalET Z88qxj1qOi0wXk/NdL1rQ2DkNh+tHLMY72uEUJjjkcupEnquOcUHoDMCsrxMXfFhdeR0 OXEkXNHPnfTRqcxhc0lVgORQVIzcAozgh3+t+gXZFXSuTUVah7RQJcI9F0PcRMfFEwJW 4tdb9trjhxIs1lwT6kOJNj/Oht+bmBg3QEh5ZtTNNqX6VQ0aCeaCjMwjClPbrL3ULhe0 wk7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LvSdQUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si17914549edv.57.2021.07.12.12.36.24; Mon, 12 Jul 2021 12:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LvSdQUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236462AbhGLTfq (ORCPT + 99 others); Mon, 12 Jul 2021 15:35:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57042 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236457AbhGLTfq (ORCPT ); Mon, 12 Jul 2021 15:35:46 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16CJ3Ta0173460; Mon, 12 Jul 2021 15:32:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=QvtW3FBa9tE1mwfOAdgXsMj45z9JyERAMcNsH2N1onA=; b=LvSdQUvsVa+CwHlDDoHFhzeCqQg2WB318Jr44xnCAAg3YPb5bx3nfgZNSAqdrcCprNsk 54MaC7pkhex8ad0pdh0YKRBsWafXgfEjhvvFsVBweA3AHewrl6FLm0qM3uQqoFFdRArT 5Iu/L5KGSaDJIrVkHf6uNBfyzW+kQ7hH53PFGe+vZ99Ralg8ggk1JGcmj5Bn+UY4ap7j CxTjt16MelCNb8DUlFrlgcAHeW4hHy2a0npdtpZQmZDGXWU9xgT+D6CkCHlI6gfmHKfA 8XvWn+4XDPZ0mZaJCyi6kNFRcxJcftbP0s4uRZ5GH5RHujETvoE0JspovH/K6Xgol196 oA== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com with ESMTP id 39qs65c008-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jul 2021 15:32:46 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16CJWNtD013401; Mon, 12 Jul 2021 19:32:45 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma02wdc.us.ibm.com with ESMTP id 39q36addyt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jul 2021 19:32:45 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16CJWiM113566422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jul 2021 19:32:44 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E6EBBE059; Mon, 12 Jul 2021 19:32:44 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F653BE054; Mon, 12 Jul 2021 19:32:44 +0000 (GMT) Received: from v0005c16 (unknown [9.211.69.66]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 12 Jul 2021 19:32:43 +0000 (GMT) Message-ID: <84e7fbd7e65a6ee363763d8155c47d74ed24f9e0.camel@linux.ibm.com> Subject: Re: [PATCH v2 2/3] net/ncsi: add NCSI Intel OEM command to keep PHY up From: Eddie James To: Joel Stanley , Ivan Mikhaylov Cc: Networking , OpenBMC Maillist , Linux Kernel Mailing List , Jakub Kicinski , Samuel Mendoza-Jonas , "David S . Miller" Date: Mon, 12 Jul 2021 14:32:43 -0500 In-Reply-To: References: <20210708122754.555846-1-i.mikhaylov@yadro.com> <20210708122754.555846-3-i.mikhaylov@yadro.com> Organization: IBM Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-16.el8) X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ULXN2HCrschaqxdNXlTeVKiKBPTP-wVY X-Proofpoint-GUID: ULXN2HCrschaqxdNXlTeVKiKBPTP-wVY Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-12_10:2021-07-12,2021-07-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 clxscore=1011 impostorscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107120135 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-07-12 at 10:01 +0000, Joel Stanley wrote: > On Thu, 8 Jul 2021 at 12:27, Ivan Mikhaylov > wrote: > > This allows to keep PHY link up and prevents any channel resets > > during > > the host load. > > > > It is KEEP_PHY_LINK_UP option(Veto bit) in i210 datasheet which > > block PHY reset and power state changes. > > How about using runtime configuration over using kconfig for this, so > the same kernel config can be used on different machines. Something > device tree based? > > Another option is to use the netlink handler to send the OEM command > from userspace. Eddie has worked on this for an IBM machine, and I've > asked him to post those changes. I would prefer the kernel option > though. For reference that is here: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-networkd/+/36592 Thanks, Eddie > > > > Signed-off-by: Ivan Mikhaylov > > --- > > net/ncsi/Kconfig | 6 ++++++ > > net/ncsi/internal.h | 5 +++++ > > net/ncsi/ncsi-manage.c | 45 > > ++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 56 insertions(+) > > > > diff --git a/net/ncsi/Kconfig b/net/ncsi/Kconfig > > index 93309081f5a4..ea1dd32b6b1f 100644 > > --- a/net/ncsi/Kconfig > > +++ b/net/ncsi/Kconfig > > @@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC > > help > > This allows to get MAC address from NCSI firmware and set > > them back to > > controller. > > +config NCSI_OEM_CMD_KEEP_PHY > > + bool "Keep PHY Link up" > > + depends on NET_NCSI > > + help > > + This allows to keep PHY link up and prevents any channel > > resets during > > + the host load. > > diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h > > index cbbb0de4750a..0b6cfd3b31e0 100644 > > --- a/net/ncsi/internal.h > > +++ b/net/ncsi/internal.h > > @@ -78,6 +78,9 @@ enum { > > /* OEM Vendor Manufacture ID */ > > #define NCSI_OEM_MFR_MLX_ID 0x8119 > > #define NCSI_OEM_MFR_BCM_ID 0x113d > > +#define NCSI_OEM_MFR_INTEL_ID 0x157 > > +/* Intel specific OEM command */ > > +#define NCSI_OEM_INTEL_CMD_KEEP_PHY 0x20 /* CMD ID for Keep > > PHY up */ > > /* Broadcom specific OEM Command */ > > #define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get > > MAC */ > > /* Mellanox specific OEM Command */ > > @@ -86,6 +89,7 @@ enum { > > #define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set > > MC Affinity */ > > #define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for > > SMAF */ > > /* OEM Command payload lengths*/ > > +#define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7 > > #define NCSI_OEM_BCM_CMD_GMA_LEN 12 > > #define NCSI_OEM_MLX_CMD_GMA_LEN 8 > > #define NCSI_OEM_MLX_CMD_SMAF_LEN 60 > > @@ -271,6 +275,7 @@ enum { > > ncsi_dev_state_probe_mlx_gma, > > ncsi_dev_state_probe_mlx_smaf, > > ncsi_dev_state_probe_cis, > > + ncsi_dev_state_probe_keep_phy, > > ncsi_dev_state_probe_gvi, > > ncsi_dev_state_probe_gc, > > ncsi_dev_state_probe_gls, > > diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c > > index 42b54a3da2e6..89c7742cd72e 100644 > > --- a/net/ncsi/ncsi-manage.c > > +++ b/net/ncsi/ncsi-manage.c > > @@ -689,6 +689,35 @@ static int set_one_vid(struct ncsi_dev_priv > > *ndp, struct ncsi_channel *nc, > > return 0; > > } > > > > +#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) > > + > > +static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca) > > +{ > > + unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN]; > > + int ret = 0; > > + > > + nca->payload = NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN; > > + > > + memset(data, 0, NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN); > > + *(unsigned int *)data = ntohl((__force > > __be32)NCSI_OEM_MFR_INTEL_ID); > > + > > + data[4] = NCSI_OEM_INTEL_CMD_KEEP_PHY; > > + > > + /* PHY Link up attribute */ > > + data[6] = 0x1; > > + > > + nca->data = data; > > + > > + ret = ncsi_xmit_cmd(nca); > > + if (ret) > > + netdev_err(nca->ndp->ndev.dev, > > + "NCSI: Failed to transmit cmd 0x%x > > during configure\n", > > + nca->type); > > + return ret; > > +} > > + > > +#endif > > + > > #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC) > > > > /* NCSI OEM Command APIs */ > > @@ -1391,8 +1420,24 @@ static void ncsi_probe_channel(struct > > ncsi_dev_priv *ndp) > > goto error; > > } > > > > + nd->state = ncsi_dev_state_probe_gvi; > > + if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)) > > + nd->state = ncsi_dev_state_probe_keep_phy; > > + break; > > +#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) > > + case ncsi_dev_state_probe_keep_phy: > > + ndp->pending_req_num = 1; > > + > > + nca.type = NCSI_PKT_CMD_OEM; > > + nca.package = ndp->active_package->id; > > + nca.channel = 0; > > + ret = ncsi_oem_keep_phy_intel(&nca); > > + if (ret) > > + goto error; > > + > > nd->state = ncsi_dev_state_probe_gvi; > > break; > > +#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */ > > case ncsi_dev_state_probe_gvi: > > case ncsi_dev_state_probe_gc: > > case ncsi_dev_state_probe_gls: > > -- > > 2.31.1 > >