From 4f1af3cb5a97638cf56bdc0273e71c62b4f0e497 Mon Sep 17 00:00:00 2001 From: Xiaoyun Wang Date: Tue, 17 Mar 2020 23:01:16 +0800 Subject: [PATCH] net/hinic: clean up logs The patch optimizes log files without "\n". Signed-off-by: Xiaoyun Wang --- drivers/net/hinic/base/hinic_pmd_mbox.c | 3 +-- drivers/net/hinic/base/hinic_pmd_mgmt.c | 9 +++---- drivers/net/hinic/base/hinic_pmd_niccfg.c | 20 +++++++-------- drivers/net/hinic/base/hinic_pmd_nicio.c | 19 ++++++-------- drivers/net/hinic/hinic_pmd_ethdev.c | 31 +++++++++++------------ 5 files changed, 37 insertions(+), 45 deletions(-) diff --git a/drivers/net/hinic/base/hinic_pmd_mbox.c b/drivers/net/hinic/base/hinic_pmd_mbox.c index 935d60bc81..bf83fbd7ef 100644 --- a/drivers/net/hinic/base/hinic_pmd_mbox.c +++ b/drivers/net/hinic/base/hinic_pmd_mbox.c @@ -191,8 +191,7 @@ static int recv_vf_mbox_handler(struct hinic_mbox_func_to_func *func_to_func, buf_out, out_size); break; default: - PMD_DRV_LOG(ERR, "No handler, mod = %d", - recv_mbox->mod); + PMD_DRV_LOG(ERR, "No handler, mod: %d", recv_mbox->mod); rc = HINIC_MBOX_VF_CMD_ERROR; break; } diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.c b/drivers/net/hinic/base/hinic_pmd_mgmt.c index eee50a80d1..addc9d2db4 100644 --- a/drivers/net/hinic/base/hinic_pmd_mgmt.c +++ b/drivers/net/hinic/base/hinic_pmd_mgmt.c @@ -449,7 +449,7 @@ hinic_pf_to_mgmt_sync(struct hinic_hwdev *hwdev, recv_msg->msg_len); *out_size = recv_msg->msg_len; } else { - PMD_DRV_LOG(ERR, "Mgmt rsp's msg len:%u overflow.", + PMD_DRV_LOG(ERR, "Mgmt rsp's msg len: %u overflow.", recv_msg->msg_len); err = -ERANGE; } @@ -577,7 +577,7 @@ static void hinic_mgmt_recv_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, buf_out, &out_size); break; default: - PMD_DRV_LOG(ERR, "No handler, mod = %d", recv_msg->mod); + PMD_DRV_LOG(ERR, "No handler, mod: %d", recv_msg->mod); break; } @@ -617,7 +617,7 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, if (!check_mgmt_seq_id_and_seg_len(recv_msg, seq_id, seq_len)) { PMD_DRV_LOG(ERR, - "Mgmt msg sequence and segment check fail, " + "Mgmt msg sequence and segment check failed, " "func id: 0x%x, front id: 0x%x, current id: 0x%x, seg len: 0x%x", hinic_global_func_id(pf_to_mgmt->hwdev), recv_msg->sed_id, seq_id, seq_len); @@ -741,8 +741,7 @@ int hinic_aeq_poll_msg(struct hinic_eq *eq, u32 timeout, void *param) event = EQ_ELEM_DESC_GET(aeqe_desc, TYPE); if (EQ_ELEM_DESC_GET(aeqe_desc, SRC)) { - PMD_DRV_LOG(ERR, "AEQ sw event not support %d", - event); + PMD_DRV_LOG(ERR, "AEQ sw event not support %d", event); return -ENODEV; } else { diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c index 0bbcd36322..6b1b7deb4f 100644 --- a/drivers/net/hinic/base/hinic_pmd_niccfg.c +++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c @@ -276,7 +276,7 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id, int err; if (!hwdev || !old_mac || !new_mac) { - PMD_DRV_LOG(ERR, "Hwdev, old_mac or new_mac is NULL\n"); + PMD_DRV_LOG(ERR, "Hwdev, old_mac or new_mac is NULL"); return -EINVAL; } @@ -293,12 +293,12 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id, if (err || !out_size || (mac_info.mgmt_msg_head.status && mac_info.mgmt_msg_head.status != HINIC_PF_SET_VF_ALREADY)) { - PMD_DRV_LOG(ERR, "Failed to update MAC, err: %d, status: 0x%x, out size: 0x%x\n", + PMD_DRV_LOG(ERR, "Failed to update MAC, err: %d, status: 0x%x, out size: 0x%x", err, mac_info.mgmt_msg_head.status, out_size); return -EINVAL; } if (mac_info.mgmt_msg_head.status == HINIC_PF_SET_VF_ALREADY) { - PMD_DRV_LOG(WARNING, "PF has already set vf mac, Ignore update operation.\n"); + PMD_DRV_LOG(WARNING, "PF has already set vf mac, Ignore update operation"); return HINIC_PF_SET_VF_ALREADY; } @@ -385,7 +385,7 @@ int hinic_add_remove_vlan(void *hwdev, u16 vlan_id, u16 func_id, bool add) &out_size); if (err || !out_size || vlan_info.mgmt_msg_head.status) { PMD_DRV_LOG(ERR, - "Failed to %s vlan, err: %d, status: 0x%x, out size: 0x%x\n", + "Failed to %s vlan, err: %d, status: 0x%x, out size: 0x%x", add ? "add" : "remove", err, vlan_info.mgmt_msg_head.status, out_size); return -EINVAL; @@ -431,7 +431,7 @@ int hinic_config_vlan_filter(void *hwdev, u32 vlan_filter_ctrl) err = HINIC_MGMT_CMD_UNSUPPORTED; } else if (err || !out_size || vlan_filter.mgmt_msg_head.status) { PMD_DRV_LOG(ERR, - "Failed to config vlan filter, vlan_filter_ctrl: 0x%x, err: %d, status: 0x%x, out size: 0x%x\n", + "Failed to config vlan filter, vlan_filter_ctrl: 0x%x, err: %d, status: 0x%x, out size: 0x%x", vlan_filter_ctrl, err, vlan_filter.mgmt_msg_head.status, out_size); err = -EINVAL; @@ -473,7 +473,7 @@ int hinic_set_rx_vlan_offload(void *hwdev, u8 en) &vlan_cfg, &out_size); if (err || !out_size || vlan_cfg.mgmt_msg_head.status) { PMD_DRV_LOG(ERR, - "Failed to set rx vlan offload, err: %d, status: 0x%x, out size: 0x%x\n", + "Failed to set rx vlan offload, err: %d, status: 0x%x, out size: 0x%x", err, vlan_cfg.mgmt_msg_head.status, out_size); return -EINVAL; } @@ -687,8 +687,7 @@ int hinic_dcb_set_ets(void *hwdev, u8 *up_tc, u8 *pg_bw, pg_bw_t += *(pg_bw + i); if (*(up_tc + i) > HINIC_DCB_TC_MAX) { - PMD_DRV_LOG(ERR, - "Invalid up %d mapping tc: %d", i, + PMD_DRV_LOG(ERR, "Invalid up %d mapping tc: %d", i, *(up_tc + i)); return -EINVAL; } @@ -1400,7 +1399,7 @@ int hinic_set_anti_attack(void *hwdev, bool enable) &rate, sizeof(rate), &rate, &out_size); if (err || !out_size || rate.mgmt_msg_head.status) { - PMD_DRV_LOG(ERR, "can't %s port Anti-Attack rate limit, err: %d, status: 0x%x, out size: 0x%x", + PMD_DRV_LOG(ERR, "Can't %s port Anti-Attack rate limit, err: %d, status: 0x%x, out size: 0x%x", (enable ? "enable" : "disable"), err, rate.mgmt_msg_head.status, out_size); return -EINVAL; @@ -1502,8 +1501,7 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode) sizeof(fast_recycled_mode), &fast_recycled_mode, &out_size, 0); if (err || fast_recycled_mode.mgmt_msg_head.status || !out_size) { - PMD_DRV_LOG(ERR, - "Failed to set recycle mode, ret = %d", + PMD_DRV_LOG(ERR, "Failed to set recycle mode, ret: %d", fast_recycled_mode.mgmt_msg_head.status); return -EFAULT; } diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c index 31a13fbdcf..fd34b03e3b 100644 --- a/drivers/net/hinic/base/hinic_pmd_nicio.c +++ b/drivers/net/hinic/base/hinic_pmd_nicio.c @@ -312,7 +312,8 @@ static int init_sq_ctxts(struct hinic_nic_io *nic_io) HINIC_UCODE_CMD_MDY_QUEUE_CONTEXT, cmd_buf, &out_param, 0); if (err || out_param != 0) { - PMD_DRV_LOG(ERR, "Failed to set SQ ctxts, err:%d", err); + PMD_DRV_LOG(ERR, "Failed to set SQ ctxts, err: %d", + err); err = -EFAULT; break; } @@ -536,7 +537,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev) if (hwdev->cmdqs->status & HINIC_CMDQ_SET_FAIL) { err = hinic_reinit_cmdq_ctxts(hwdev); if (err) { - PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d\n", + PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d", err); return err; } @@ -551,8 +552,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev) /* clean LRO/TSO context space */ err = clean_qp_offload_ctxt(nic_io); if (err) { - PMD_DRV_LOG(ERR, "Clean qp offload ctxts failed, rc: %d", - err); + PMD_DRV_LOG(ERR, "Clean qp offload ctxts failed, rc: %d", err); return err; } @@ -561,16 +561,14 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev) /* update rx buf size to function table */ err = hinic_set_rx_vhd_mode(hwdev, 0, rx_buf_sz); if (err) { - PMD_DRV_LOG(ERR, "Set rx vhd mode failed, rc: %d", - err); + PMD_DRV_LOG(ERR, "Set rx vhd mode failed, rc: %d", err); return err; } err = hinic_set_root_ctxt(hwdev, nic_io->rq_depth, nic_io->sq_depth, rx_buf_sz); if (err) { - PMD_DRV_LOG(ERR, "Set root context failed, rc: %d", - err); + PMD_DRV_LOG(ERR, "Set root context failed, rc: %d", err); return err; } @@ -585,8 +583,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev) sq_attr.dma_attr_off = 0; err = hinic_set_ci_table(hwdev, q_id, &sq_attr); if (err) { - PMD_DRV_LOG(ERR, "Set ci table failed, rc: %d", - err); + PMD_DRV_LOG(ERR, "Set ci table failed, rc: %d", err); goto set_cons_idx_table_err; } } @@ -744,7 +741,7 @@ static int hinic_alloc_nicio(struct hinic_hwdev *hwdev) max_qps = hinic_func_max_qnum(hwdev); if ((max_qps & (max_qps - 1))) { - PMD_DRV_LOG(ERR, "wrong number of max_qps: %d", + PMD_DRV_LOG(ERR, "Wrong number of max_qps: %d", max_qps); return -EINVAL; } diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 9e90056f92..22e3efa267 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -347,7 +347,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev) err = hinic_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK); if (err) { - PMD_DRV_LOG(ERR, "Initialize vlan filter and strip failed\n"); + PMD_DRV_LOG(ERR, "Initialize vlan filter and strip failed"); (void)hinic_config_mq_mode(dev, FALSE); return err; } @@ -785,7 +785,7 @@ static int hinic_fw_version_get(struct rte_eth_dev *dev, char *fw_version, err = hinic_get_mgmt_version(nic_dev->hwdev, fw_ver); if (err) { - PMD_DRV_LOG(ERR, "Failed to get fw version\n"); + PMD_DRV_LOG(ERR, "Failed to get fw version"); return -EINVAL; } @@ -1198,7 +1198,7 @@ static void hinic_dev_stop(struct rte_eth_dev *dev) /* just stop phy port and vport */ rc = hinic_set_port_enable(nic_dev->hwdev, false); if (rc) - PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name:%s, port_id:%d", + PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name: %s, port_id: %d", rc, name, port_id); rc = hinic_set_vport_enable(nic_dev->hwdev, false); @@ -1861,7 +1861,7 @@ static int hinic_rss_hash_update(struct rte_eth_dev *dev, } if (rss_conf->rss_key_len > HINIC_RSS_KEY_SIZE) { - PMD_DRV_LOG(ERR, "Invalid rss key, rss_key_len:%d", + PMD_DRV_LOG(ERR, "Invalid rss key, rss_key_len: %d", rss_conf->rss_key_len); return HINIC_ERROR; } @@ -1982,7 +1982,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev, return HINIC_OK; if (reta_size != NIC_RSS_INDIR_SIZE) { - PMD_DRV_LOG(ERR, "Invalid reta size, reta_size:%d", reta_size); + PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size); return HINIC_ERROR; } @@ -2000,7 +2000,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev, for (i = 0 ; i < reta_size; i++) { if (indirtbl[i] >= nic_dev->num_rq) { - PMD_DRV_LOG(ERR, "Invalid reta entry, index:%d, num_rq:%d", + PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d", i, nic_dev->num_rq); goto disable_rss; } @@ -2047,13 +2047,13 @@ static int hinic_rss_indirtbl_query(struct rte_eth_dev *dev, u16 i = 0; if (reta_size != NIC_RSS_INDIR_SIZE) { - PMD_DRV_LOG(ERR, "Invalid reta size, reta_size:%d", reta_size); + PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size); return HINIC_ERROR; } err = hinic_rss_get_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl); if (err) { - PMD_DRV_LOG(ERR, "Get rss indirect table failed, error:%d", + PMD_DRV_LOG(ERR, "Get rss indirect table failed, error: %d", err); return err; } @@ -2272,7 +2272,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev, rte_ether_addr_copy(addr, &nic_dev->default_addr); - PMD_DRV_LOG(INFO, "Set new mac address %02x:%02x:%02x:%02x:%02x:%02x\n", + PMD_DRV_LOG(INFO, "Set new mac address %02x:%02x:%02x:%02x:%02x:%02x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], addr->addr_bytes[4], addr->addr_bytes[5]); @@ -2286,7 +2286,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev, * @param dev * Pointer to Ethernet device structure. * @param index - * MAC address index. + * MAC address index, should less than 128. */ static void hinic_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { @@ -2315,16 +2315,15 @@ static void hinic_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * @param dev * Pointer to Ethernet device structure. * @param mac_addr - * MAC address to register. + * Pointer to MAC address * @param index - * MAC address index. + * MAC address index, should less than 128. * @param vmdq - * VMDq pool index to associate address with (ignored). + * VMDq pool index(not used). * * @return - * 0 on success, a negative errno value otherwise and rte_errno is set. + * 0 on success, negative error value otherwise. */ - static int hinic_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, __rte_unused uint32_t vmdq) @@ -2335,7 +2334,7 @@ static int hinic_mac_addr_add(struct rte_eth_dev *dev, int ret; if (index >= HINIC_MAX_UC_MAC_ADDRS) { - PMD_DRV_LOG(INFO, "Add mac index(%u) is out of range,", index); + PMD_DRV_LOG(INFO, "Add mac index(%u) is out of range", index); return -EINVAL; } -- 2.20.1