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 6001CA2EDB for ; Sun, 29 Sep 2019 14:09:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B9D22D13; Sun, 29 Sep 2019 14:09:28 +0200 (CEST) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id C6AD51F28 for ; Sun, 29 Sep 2019 14:09:26 +0200 (CEST) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DAFBFA07535F11C64247; Sun, 29 Sep 2019 20:09:24 +0800 (CST) Received: from [127.0.0.1] (10.57.115.182) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Sun, 29 Sep 2019 20:09:16 +0800 To: Ferruh Yigit , References: <1569506528-60464-1-git-send-email-xavier.huwei@huawei.com> <1569506528-60464-19-git-send-email-xavier.huwei@huawei.com> CC: , , , From: "Wei Hu (Xavier)" Message-ID: <3b44b7ea-e150-7eef-710c-02a41613bca8@huawei.com> Date: Sun, 29 Sep 2019 20:09:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.115.182] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v3 18/22] net/hns3: add dump register ops for hns3 PMD driver 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 2019/9/28 2:31, Ferruh Yigit wrote: > On 9/26/2019 3:02 PM, Wei Hu (Xavier) wrote: >> This patch adds get_reg related function codes for hns3 PMD driver. >> >> Signed-off-by: Wei Hu (Xavier) >> Signed-off-by: Chunsong Feng >> Signed-off-by: Min Hu (Connor) >> Signed-off-by: Hao Chen >> Signed-off-by: Huisong Li > <...> > >> +static int >> +hns3_get_32_bit_regs(struct hns3_hw *hw, uint32_t regs_num, void *data) >> +{ >> +#define HNS3_32_BIT_REG_RTN_DATANUM 8 >> +#define HNS3_32_BIT_DESC_NODATA_LEN 2 >> + struct hns3_cmd_desc *desc; >> + uint32_t *reg_val = data; >> + uint32_t *desc_data; >> + int cmd_num; >> + int i, k, n; >> + int ret; >> + >> + if (regs_num == 0) >> + return 0; >> + >> + cmd_num = DIV_ROUND_UP(regs_num + HNS3_32_BIT_DESC_NODATA_LEN, >> + HNS3_32_BIT_REG_RTN_DATANUM); >> + desc = rte_zmalloc("hns3-32bit-regs", >> + sizeof(struct hns3_cmd_desc) * cmd_num, 0); >> + if (desc == NULL) { >> + hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed to " >> + "store 32bit regs", >> + sizeof(struct hns3_cmd_desc) * cmd_num); > 'PRIx64' won't work with 'sizeof' because its return type changes with the arch, > need to use %zx with 'sizeof' > > I am aware that driver doesn't support 32-bits, but build is only broken because > of the format errors in the log formatting, I am for fixing them. Also using > correct format type is good practice. > > There are following related errors [1], I am fixing them while merging [2] > please let me know if you request any change in the updated code. > > Thanks you very much! Ferruh Yigit Best regards, Xavier > > > [1] > .../drivers/net/hns3/hns3_regs.c(167): > error #181: argument of type "unsigned int" is incompatible with format "%llx", > expecting argument of type "unsigned long long" > hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed to " > ^ > > .../drivers/net/hns3/hns3_regs.c(224): error #181: argument of type "unsigned > int" is incompatible with format "%llx", expecting argument of type "unsigned > long long" > hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed to " > ^ > > .../drivers/net/hns3/hns3_ethdev_vf.c(1625): > error #181: argument of type "unsigned int" is incompatible with format "%llx", > expecting argument of type "unsigned long long" > PMD_INIT_LOG(ERR, "Failed to allocate %" PRIx64 " bytes needed " > ^ > > .../drivers/net/hns3/hns3_rxtx.c(643): > error #181: argument of type "uint64_t={__uint64_t={unsigned long long}}" is > incompatible with format "%lx", expecting argument of type "unsigned long" > hns3_dbg(hw, "No.%d rx descriptors iova 0x%lx", idx, > ^ > > .../drivers/net/hns3/hns3_rxtx.c(1085): > error #181: argument of type "uint64_t={__uint64_t={unsigned long long}}" is > incompatible with format "%lx", expecting argument of type "unsigned long" > hns3_dbg(hw, "No.%d tx descriptors iova 0x%lx", idx, > ^ > > .../drivers/net/hns3/hns3_ethdev.c(4837): > error #181: argument of type "unsigned int" is incompatible with format "%llx", > expecting argument of type "unsigned long long" > PMD_INIT_LOG(ERR, "Failed to allocate %" PRIx64 " bytes needed " > ^ > > [2] > > diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c > index 574eb9204..862a717fd 100644 > --- a/drivers/net/hns3/hns3_ethdev.c > +++ b/drivers/net/hns3/hns3_ethdev.c > @@ -4834,7 +4834,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) > sizeof(struct rte_ether_addr) * > HNS3_UC_MACADDR_NUM, 0); > if (eth_dev->data->mac_addrs == NULL) { > - PMD_INIT_LOG(ERR, "Failed to allocate %" PRIx64 " bytes needed " > + PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " > "to store MAC addresses", > sizeof(struct rte_ether_addr) * > HNS3_UC_MACADDR_NUM); > diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c > index 07a4b01d6..121beb58d 100644 > --- a/drivers/net/hns3/hns3_ethdev_vf.c > +++ b/drivers/net/hns3/hns3_ethdev_vf.c > @@ -1622,7 +1622,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) > sizeof(struct rte_ether_addr) * > HNS3_VF_UC_MACADDR_NUM, 0); > if (eth_dev->data->mac_addrs == NULL) { > - PMD_INIT_LOG(ERR, "Failed to allocate %" PRIx64 " bytes needed " > + PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " > "to store MAC addresses", > sizeof(struct rte_ether_addr) * > HNS3_VF_UC_MACADDR_NUM); > diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c > index d83eef339..23405030e 100644 > --- a/drivers/net/hns3/hns3_regs.c > +++ b/drivers/net/hns3/hns3_regs.c > @@ -164,7 +164,7 @@ hns3_get_32_bit_regs(struct hns3_hw *hw, uint32_t regs_num, > void *data) > desc = rte_zmalloc("hns3-32bit-regs", > sizeof(struct hns3_cmd_desc) * cmd_num, 0); > if (desc == NULL) { > - hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed to " > + hns3_err(hw, "Failed to allocate %zx bytes needed to " > "store 32bit regs", > sizeof(struct hns3_cmd_desc) * cmd_num); > return -ENOMEM; > @@ -221,7 +221,7 @@ hns3_get_64_bit_regs(struct hns3_hw *hw, uint32_t regs_num, > void *data) > desc = rte_zmalloc("hns3-64bit-regs", > sizeof(struct hns3_cmd_desc) * cmd_num, 0); > if (desc == NULL) { > - hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed to " > + hns3_err(hw, "Failed to allocate %zx bytes needed to " > "store 64bit regs", > sizeof(struct hns3_cmd_desc) * cmd_num); > return -ENOMEM; > diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c > index b29d98a2f..184b8e4b6 100644 > --- a/drivers/net/hns3/hns3_rxtx.c > +++ b/drivers/net/hns3/hns3_rxtx.c > @@ -640,7 +640,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, > uint16_t nb_desc, > rxq->rx_ring = (struct hns3_desc *)rx_mz->addr; > rxq->rx_ring_phys_addr = rx_mz->iova; > > - hns3_dbg(hw, "No.%d rx descriptors iova 0x%lx", idx, > + hns3_dbg(hw, "No.%d rx descriptors iova 0x%" PRIx64, idx, > rxq->rx_ring_phys_addr); > > rxq->next_to_use = 0; > @@ -1082,7 +1082,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t > idx, uint16_t nb_desc, > txq->tx_ring = (struct hns3_desc *)tx_mz->addr; > txq->tx_ring_phys_addr = tx_mz->iova; > > - hns3_dbg(hw, "No.%d tx descriptors iova 0x%lx", idx, > + hns3_dbg(hw, "No.%d tx descriptors iova 0x%" PRIx64, idx, > txq->tx_ring_phys_addr); > > /* Clear tx bd */ > > . >