From: Ferruh Yigit <ferruh.yigit@intel.com>
To: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>, dev@dpdk.org
Cc: linuxarm@huawei.com, xavier_huwei@163.com, xavier.huwei@tom.com,
forest.zhouchang@huawei.com
Subject: Re: [dpdk-dev] [PATCH v3 18/22] net/hns3: add dump register ops for hns3 PMD driver
Date: Fri, 27 Sep 2019 19:31:02 +0100 [thread overview]
Message-ID: <fbd60312-51ea-da19-bb1f-d615879c3591@intel.com> (raw)
In-Reply-To: <1569506528-60464-19-git-send-email-xavier.huwei@huawei.com>
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) <xavier.huwei@huawei.com>
> Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Signed-off-by: Hao Chen <chenhao164@huawei.com>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
<...>
> +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.
[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 */
next prev parent reply other threads:[~2019-09-27 18:31 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 14:01 [dpdk-dev] [PATCH v3 00/22] add hns3 ethernet " Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 01/22] net/hns3: add build and doc infrastructure Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 02/22] net/hns3: add hardware registers definition Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 03/22] net/hns3: add some definitions for data structure and macro Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 04/22] net/hns3: register hns3 PMD driver and add the log interface definition Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 05/22] net/hns3: add support for cmd of hns3 PMD driver Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 06/22] net/hns3: add the initialization " Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 07/22] net/hns3: add support for MAC address related operations Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 08/22] net/hns3: add support for some misc operations Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 09/22] net/hns3: add support for link_update operation Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 10/22] net/hns3: add support for flow directory of hns3 PMD driver Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 11/22] net/hns3: add support for RSS " Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 12/22] net/hns3: add support for flow control " Wei Hu (Xavier)
2019-09-26 14:01 ` [dpdk-dev] [PATCH v3 13/22] net/hns3: add support for vlan " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 14/22] net/hns3: add support for mailbox " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 15/22] net/hns3: add support for hns3 VF " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 16/22] net/hns3: add RX/TX package burst and queue related operation Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 17/22] net/hns3: add start stop configure promiscuous ops Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 18/22] net/hns3: add dump register ops for hns3 PMD driver Wei Hu (Xavier)
2019-09-27 18:31 ` Ferruh Yigit [this message]
2019-09-29 12:09 ` Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 19/22] net/hns3: add abnormal interrupt process " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 20/22] net/hns3: add stats related ops " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 21/22] net/hns3: add reset related process " Wei Hu (Xavier)
2019-09-26 14:02 ` [dpdk-dev] [PATCH v3 22/22] net/hns3: add multiple process support " Wei Hu (Xavier)
2019-09-27 6:52 ` [dpdk-dev] [PATCH v3 00/22] add hns3 ethernet " Wei Hu (Xavier)
2019-09-27 8:47 ` Ferruh Yigit
2019-09-27 19:16 ` Jeremy Plsek
2019-09-27 18:30 ` Ferruh Yigit
2019-09-29 12:12 ` Wei Hu (Xavier)
2019-09-30 8:52 ` Ferruh Yigit
2019-10-11 1:30 ` Wei Hu (Xavier)
2019-10-10 17:10 ` Ferruh Yigit
2019-10-11 1:39 ` Wei Hu (Xavier)
2019-10-11 2:40 ` Wei Hu (Xavier)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbd60312-51ea-da19-bb1f-d615879c3591@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=forest.zhouchang@huawei.com \
--cc=linuxarm@huawei.com \
--cc=xavier.huwei@huawei.com \
--cc=xavier.huwei@tom.com \
--cc=xavier_huwei@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).