From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91F6DA057B; Wed, 1 Apr 2020 11:28:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 34E101BE9B; Wed, 1 Apr 2020 11:28:27 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 58E1C1BE95 for ; Wed, 1 Apr 2020 11:28:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585733304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=7q//aLC9kU4Yo0Vz4aOZ2+Z699XqTKd/cAzxcfiJWUc=; b=fDWOngMbh2ADQcC2pYJsfJqubD2Jhp+eASZ12jzA8Jit+UHcCQyYG9vq8GeRjEtTgLbSKI k+jhYNoP4ChfZqshHQAxBVusGMHmc3i0cI6LgANq1pyXlZ3Uaz9B5RmcXcI77hX3vw+/Xo o6atyrcqzGL3QigtKwh8X24dlrhXz7Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-W91BMba_OmGJK04G0bQ2Zg-1; Wed, 01 Apr 2020 05:28:21 -0400 X-MC-Unique: W91BMba_OmGJK04G0bQ2Zg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52F4B100551A; Wed, 1 Apr 2020 09:28:19 +0000 (UTC) Received: from [10.33.36.227] (unknown [10.33.36.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7747912B0; Wed, 1 Apr 2020 09:28:16 +0000 (UTC) To: Xiaoyun wang , dev@dpdk.org Cc: ferruh.yigit@intel.com, bluca@debian.org, luoxianjun@huawei.com, luoxingyu@huawei.com, zhouguoyang@huawei.com, xuanziyang2@huawei.com, shahar.belkar@huawei.com, yin.yinshi@huawei.com References: <5807ad3c2a214c1ed363fb36003344f731b7f1d9.1585731196.git.cloud.wangxiaoyun@huawei.com> From: Kevin Traynor Autocrypt: addr=ktraynor@redhat.com; keydata= mQINBF2J2awBEADUEPNhgNI+nJNgiTAUcw4YIgVXEoHlsNPyyzG1BEXkWXALy0Y3fNTiw6+r ltWDkF9jzL9kfkecgQ67itGfk1OaBXgSGKuw1PUpxAwX2Bi76LAR6M5OsyGM9TSVVQwARalz hMwRBIZPzPc7or6Pw7jAOJ8SQGJ1Zlp1YJCjrvpe87V1tH/LY8Wnxn/EuoseFmWILAQZAtYS tGjcrAgYn3SPMLR1B0BP5bTBY06vWQjiufH8drenfDnMJAzuBdG1mqjnTqCjULZ3Hunv4xqZ aMnkvL/K5Tj1c12Oe4930EE53LrXIBUltRg5mBudSWHnC7twjH0082HH9f963Z/2UI63SFIT iUvRvAzJYytgy7XnWLQ0+goZBADKYfolOuC0H8VgCaux8u8KFF28Dy+N6TV2KI58jTlyg1Zu l7QwykZpnOkJFiy37Gfbu3YEOzO72cP/S7/A+zvuqkxi63jyEkd+FY99vLt/HN2MUZwRmKDw UPbLkmrs8WU01/POVsqDcfvz7vu2St8hqqTiSIdQGS2zyTKB2/DvPSM3jws3udkIYSuhn+X4 QBiV6lkVZ7DSE6a065gnAauAql+b32Eymy+xnG5jCt1tR+0Cp2VZYCR9OU2gmomUKBDoX/He pSgED01CqYPNjN+TddirwmQX7ep4DtXc8FWvv2g/pq9WZFQk2QARAQABtCNLZXZpbiBUcmF5 bm9yIDxrdHJheW5vckByZWRoYXQuY29tPokCTgQTAQgAO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kalemFbWfI2unns4Papvo tk9igVqyp6EJDU98z5TJioCVojwK2laDaoIjTJk9YYv3iwCsqPd5feU= Message-ID: <7a94802f-cd1d-0abb-7893-61a30fd50305@redhat.com> Date: Wed, 1 Apr 2020 10:28:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <5807ad3c2a214c1ed363fb36003344f731b7f1d9.1585731196.git.cloud.wangxiaoyun@huawei.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/hinic/base: fix FW hotactive problem X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 01/04/2020 10:30, Xiaoyun wang wrote: > When PF detects FW is hotactive, up returns HINIC_DEV_BUSY_ACTIVE_FW for > pf driver, when cmdq reinit at txrx flush, cmdq will fail, driver should > reinit the cmdq when port start. >=20 > Fixes: d9ce1917941c ("net/hinic/base: add hardware operation") Hi. Please add tag below if you are requesting this for backport. (http://doc.dpdk.org/guides/contributing/patches.html#patch-for-stable-rele= ases) Cc: stable@dpdk.org > Signed-off-by: Xiaoyun wang > --- > drivers/net/hinic/base/hinic_pmd_cmdq.c | 7 ++++-- > drivers/net/hinic/base/hinic_pmd_hwdev.c | 4 ++-- > drivers/net/hinic/base/hinic_pmd_mgmt.c | 40 ++++++++++++++++++--------= ------ > drivers/net/hinic/base/hinic_pmd_mgmt.h | 2 ++ > drivers/net/hinic/base/hinic_pmd_nicio.c | 2 +- > drivers/net/hinic/hinic_pmd_ethdev.c | 7 +----- > 6 files changed, 33 insertions(+), 29 deletions(-) >=20 > diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.c b/drivers/net/hinic/= base/hinic_pmd_cmdq.c > index 685498e..2e98b9c 100644 > --- a/drivers/net/hinic/base/hinic_pmd_cmdq.c > +++ b/drivers/net/hinic/base/hinic_pmd_cmdq.c > @@ -440,9 +440,12 @@ static int hinic_set_cmdq_ctxts(struct hinic_hwdev *= hwdev) > =09=09=09=09=09 cmdq_ctxt, in_size, NULL, > =09=09=09=09=09 NULL, 0); > =09=09if (err) { > -=09=09=09if (err =3D=3D HINIC_MBOX_PF_BUSY_ACTIVE_FW) > +=09=09=09if (err =3D=3D HINIC_MBOX_PF_BUSY_ACTIVE_FW || > +=09=09=09=09err =3D=3D HINIC_DEV_BUSY_ACTIVE_FW) { > =09=09=09=09cmdqs->status |=3D HINIC_CMDQ_SET_FAIL; > -=09=09=09PMD_DRV_LOG(ERR, "Set cmdq ctxt failed"); > +=09=09=09=09PMD_DRV_LOG(ERR, "PF or VF fw is hot active"); > +=09=09=09} > +=09=09=09PMD_DRV_LOG(ERR, "Set cmdq ctxt failed, err: %d", err); > =09=09=09return -EFAULT; > =09=09} > =09} > diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic= /base/hinic_pmd_hwdev.c > index cf2a970..fc11ecd 100644 > --- a/drivers/net/hinic/base/hinic_pmd_hwdev.c > +++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c > @@ -529,7 +529,7 @@ static int hinic_vf_rx_tx_flush(struct hinic_hwdev *h= wdev) > =20 > =09err =3D hinic_reinit_cmdq_ctxts(hwdev); > =09if (err) > -=09=09PMD_DRV_LOG(WARNING, "Reinit cmdq failed"); > +=09=09PMD_DRV_LOG(WARNING, "Reinit cmdq failed when vf flush"); > =20 > =09return err; > } > @@ -587,7 +587,7 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *h= wdev) > =20 > =09err =3D hinic_reinit_cmdq_ctxts(hwdev); > =09if (err) > -=09=09PMD_DRV_LOG(WARNING, "Reinit cmdq failed"); > +=09=09PMD_DRV_LOG(WARNING, "Reinit cmdq failed when pf flush"); > =20 > =09return 0; > } > diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.c b/drivers/net/hinic/= base/hinic_pmd_mgmt.c > index addc9d2..06c9b68 100644 > --- a/drivers/net/hinic/base/hinic_pmd_mgmt.c > +++ b/drivers/net/hinic/base/hinic_pmd_mgmt.c > @@ -248,6 +248,19 @@ static void free_msg_buf(struct hinic_msg_pf_to_mgmt= *pf_to_mgmt) > =09free_recv_msg(&pf_to_mgmt->recv_msg_from_mgmt); > } > =20 > +static int hinic_get_mgmt_channel_status(void *hwdev) > +{ > +=09struct hinic_hwif *hwif =3D ((struct hinic_hwdev *)hwdev)->hwif; > +=09u32 val; > + > +=09if (hinic_func_type((struct hinic_hwdev *)hwdev) =3D=3D TYPE_VF) > +=09=09return false; > + > +=09val =3D hinic_hwif_read_reg(hwif, HINIC_ICPL_RESERVD_ADDR); > + > +=09return HINIC_GET_MGMT_CHANNEL_STATUS(val, MGMT_CHANNEL_STATUS); > +} > + > /** > * send_msg_to_mgmt_async - send async message > * @pf_to_mgmt: PF to MGMT channel > @@ -309,6 +322,14 @@ static int send_msg_to_mgmt_sync(struct hinic_msg_pf= _to_mgmt *pf_to_mgmt, > =09u64 header; > =09u16 cmd_size =3D mgmt_msg_len(msg_len); > =20 > +=09/* If fw is hot active, return failed */ > +=09if (hinic_get_mgmt_channel_status(pf_to_mgmt->hwdev)) { > +=09=09if (mod =3D=3D HINIC_MOD_COMM || mod =3D=3D HINIC_MOD_L2NIC) > +=09=09=09return HINIC_DEV_BUSY_ACTIVE_FW; > +=09=09else > +=09=09=09return -EBUSY; > +=09} > + > =09if (direction =3D=3D HINIC_MSG_RESPONSE) > =09=09prepare_header(pf_to_mgmt, &header, msg_len, mod, ack_type, > =09=09=09 direction, cmd, resp_msg_id); > @@ -449,7 +470,7 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev = *hwdev) > =09=09=09 recv_msg->msg_len); > =09=09=09*out_size =3D recv_msg->msg_len; > =09=09} else { > -=09=09=09PMD_DRV_LOG(ERR, "Mgmt rsp's msg len: %u overflow.", > +=09=09=09PMD_DRV_LOG(ERR, "Mgmt rsp's msg len:%u overflow.", > =09=09=09=09recv_msg->msg_len); > =09=09=09err =3D -ERANGE; > =09=09} > @@ -462,19 +483,6 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev= *hwdev) > =09return err; > } > =20 > -static int hinic_get_mgmt_channel_status(void *hwdev) > -{ > -=09struct hinic_hwif *hwif =3D ((struct hinic_hwdev *)hwdev)->hwif; > -=09u32 val; > - > -=09if (hinic_func_type((struct hinic_hwdev *)hwdev) =3D=3D TYPE_VF) > -=09=09return false; > - > -=09val =3D hinic_hwif_read_reg(hwif, HINIC_ICPL_RESERVD_ADDR); > - > -=09return HINIC_GET_MGMT_CHANNEL_STATUS(val, MGMT_CHANNEL_STATUS); > -} > - > int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, > =09=09=09 void *buf_in, u16 in_size, > =09=09=09 void *buf_out, u16 *out_size, u32 timeout) > @@ -484,10 +492,6 @@ int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_m= od_type mod, u8 cmd, > =09if (!hwdev || in_size > HINIC_MSG_TO_MGMT_MAX_LEN) > =09=09return -EINVAL; > =20 > -=09/* If status is hot upgrading, don't send message to mgmt */ > -=09if (hinic_get_mgmt_channel_status(hwdev)) > -=09=09return -EPERM; > - > =09if (hinic_func_type(hwdev) =3D=3D TYPE_VF) { > =09=09rc =3D hinic_mbox_to_pf(hwdev, mod, cmd, buf_in, in_size, > =09=09=09=09=09buf_out, out_size, timeout); > diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.h b/drivers/net/hinic/= base/hinic_pmd_mgmt.h > index cc18843..52b319e 100644 > --- a/drivers/net/hinic/base/hinic_pmd_mgmt.h > +++ b/drivers/net/hinic/base/hinic_pmd_mgmt.h > @@ -34,6 +34,8 @@ > #define HINIC_MSG_HEADER_P2P_IDX_MASK=09=09=09=090xF > #define HINIC_MSG_HEADER_MSG_ID_MASK=09=09=09=090x3FF > =20 > +#define HINIC_DEV_BUSY_ACTIVE_FW=09=09=09=090xFE > + > #define HINIC_MSG_HEADER_GET(val, member)=09=09=09\ > =09=09(((val) >> HINIC_MSG_HEADER_##member##_SHIFT) & \ > =09=09HINIC_MSG_HEADER_##member##_MASK) > diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic= /base/hinic_pmd_nicio.c > index fd34b03..60c4e14 100644 > --- a/drivers/net/hinic/base/hinic_pmd_nicio.c > +++ b/drivers/net/hinic/base/hinic_pmd_nicio.c > @@ -537,7 +537,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev) > =09if (hwdev->cmdqs->status & HINIC_CMDQ_SET_FAIL) { > =09=09err =3D hinic_reinit_cmdq_ctxts(hwdev); > =09=09if (err) { > -=09=09=09PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d", > +=09=09=09PMD_DRV_LOG(ERR, "Reinit cmdq context failed when dev start, er= r: %d", > =09=09=09=09err); > =09=09=09return err; > =09=09} > diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hin= ic_pmd_ethdev.c > index 23724a0..239a78c 100644 > --- a/drivers/net/hinic/hinic_pmd_ethdev.c > +++ b/drivers/net/hinic/hinic_pmd_ethdev.c > @@ -1862,11 +1862,6 @@ static int hinic_flow_ctrl_get(struct rte_eth_dev = *dev, > =09else > =09=09fc_conf->mode =3D RTE_FC_NONE; > =20 > -=09PMD_DRV_LOG(INFO, "Get pause options, tx: %s, rx: %s, auto: %s\n", > -=09=09nic_pause.tx_pause ? "on" : "off", > -=09=09nic_pause.rx_pause ? "on" : "off", > -=09=09nic_pause.auto_neg ? "on" : "off"); > - > =09return 0; > } > =20 > @@ -1900,7 +1895,7 @@ static int hinic_flow_ctrl_set(struct rte_eth_dev *= dev, > =09nic_dev->nic_pause.rx_pause =3D nic_pause.rx_pause; > =09nic_dev->nic_pause.tx_pause =3D nic_pause.tx_pause; > =20 > -=09PMD_DRV_LOG(INFO, "Get pause options, tx: %s, rx: %s, auto: %s\n", > +=09PMD_DRV_LOG(INFO, "Set pause options, tx: %s, rx: %s, auto: %s\n", > =09=09nic_pause.tx_pause ? "on" : "off", > =09=09nic_pause.rx_pause ? "on" : "off", > =09=09nic_pause.auto_neg ? "on" : "off"); >=20