From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
In the x86 system, the hinic device turns off LRO by default, and the LRO state will not be set when the driver is loaded. If the LRO of the chip is turned on before the driver is loaded, it will cause the chip to still turn on LRO after reloading the driver, but the LRO that the user sees is turned off. Therefore, the driver is forced to set the default features of the device when probe.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Wangxiaoyun cloud.wangxiaoyun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index cf7b6ceef060..26cd2929f60a 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -1491,7 +1491,7 @@ static int set_feature_lro(struct hinic_nic_dev *nic_dev,
static int set_features(struct hinic_nic_dev *nic_dev, netdev_features_t pre_features, - netdev_features_t features, bool force_change) + netdev_features_t features) { netdev_features_t failed_features = 0; u32 err; @@ -1518,7 +1518,7 @@ static int hinic_set_features(struct net_device *netdev, struct hinic_nic_dev *nic_dev = netdev_priv(netdev);
return set_features(nic_dev, nic_dev->netdev->features, - features, false); + features); }
static netdev_features_t hinic_fix_features(struct net_device *netdev, @@ -1563,7 +1563,8 @@ static int hinic_set_default_hw_feature(struct hinic_nic_dev *nic_dev) }
/* enable all hw features in netdev->features */ - return set_features(nic_dev, 0, nic_dev->netdev->features, true); + return set_features(nic_dev, ~nic_dev->netdev->features, + nic_dev->netdev->features); }
static int hinic_setup_tc_mqprio(struct net_device *dev,
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
If the hinic driver fails to alloc memory during the packet receiving process, it will print two logs. When the system memory is probabilistically insufficient, the hinic device will print logs repeatedly, causing system oops. Use statistics instead of logging in the IO process.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Wangxiaoyun cloud.wangxiaoyun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../net/ethernet/huawei/hinic/hinic_ethtool.c | 3 +++ drivers/net/ethernet/huawei/hinic/hinic_main.c | 3 ++- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 18 ++++++++++-------- drivers/net/ethernet/huawei/hinic/hinic_rx.h | 3 +++ 4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c index ff6a3d7fe9ad..9fa5af2dacce 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c @@ -114,10 +114,13 @@ static struct hinic_stats hinic_rx_queue_stats[] = { HINIC_RXQ_STAT(csum_errors), HINIC_RXQ_STAT(other_errors), HINIC_RXQ_STAT(dropped), + HINIC_RXQ_STAT(rx_buf_empty), };
static struct hinic_stats hinic_rx_queue_stats_extern[] = { HINIC_RXQ_STAT(alloc_skb_err), + HINIC_RXQ_STAT(alloc_rx_buf_err), + HINIC_RXQ_STAT(map_rx_buf_err), };
static struct hinic_stats hinic_tx_queue_stats[] = { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 26cd2929f60a..d0c4bdf7383c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -137,7 +137,8 @@ MODULE_PARM_DESC(qp_coalesc_timer_high, "MSI-X adaptive high coalesce time, rang
#define HINIC_NIC_DEV_WQ_NAME "hinic_nic_dev_wq"
-#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_LINK) +#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_LINK | \ + NETIF_MSG_RX_ERR)
#define QID_MASKED(q_id, nic_dev) ((q_id) & ((nic_dev)->num_qps - 1))
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index 0f597c38c02d..212a281200c4 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -69,8 +69,7 @@ static bool rx_alloc_mapped_page(struct hinic_rxq *rxq, /* alloc new page for storage */ page = alloc_pages_node(NUMA_NO_NODE, GFP_ATOMIC, nic_dev->page_order); if (unlikely(!page)) { - nicif_err(nic_dev, drv, netdev, "Alloc rxq: %d page failed\n", - rxq->q_id); + RXQ_STATS_INC(rxq, alloc_rx_buf_err); return false; }
@@ -82,7 +81,7 @@ static bool rx_alloc_mapped_page(struct hinic_rxq *rxq, * there isn't much point in holding memory we can't use */ if (unlikely(dma_mapping_error(&pdev->dev, dma))) { - nicif_err(nic_dev, drv, netdev, "Failed to map page to rx buffer\n"); + RXQ_STATS_INC(rxq, map_rx_buf_err); __free_pages(page, nic_dev->page_order); return false; } @@ -162,9 +161,8 @@ static int hinic_rx_fill_buffers(struct hinic_rxq *rxq) rxq->next_to_update); rxq->delta -= i; rxq->next_to_alloc = rxq->next_to_update; - } else { - nicif_err(nic_dev, drv, netdev, "Failed to allocate rx buffers, rxq id: %d\n", - rxq->q_id); + } else if (free_wqebbs == rxq->q_depth - 1) { + RXQ_STATS_INC(rxq, rx_buf_empty); }
return i; @@ -385,6 +383,7 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, stats->csum_errors = rxq_stats->csum_errors; stats->other_errors = rxq_stats->other_errors; stats->dropped = rxq_stats->dropped; + stats->rx_buf_empty = rxq_stats->rx_buf_empty; } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); u64_stats_update_end(&stats->syncp); } @@ -400,6 +399,9 @@ void hinic_rxq_clean_stats(struct hinic_rxq_stats *rxq_stats) rxq_stats->dropped = 0;
rxq_stats->alloc_skb_err = 0; + rxq_stats->alloc_rx_buf_err = 0; + rxq_stats->map_rx_buf_err = 0; + rxq_stats->rx_buf_empty = 0; u64_stats_update_end(&rxq_stats->syncp); }
@@ -486,11 +488,11 @@ static void hinic_copy_lp_data(struct hinic_nic_dev *nic_dev,
if (nic_dev->lb_test_rx_idx == LP_PKT_CNT) { nic_dev->lb_test_rx_idx = 0; - nicif_warn(nic_dev, drv, netdev, "Loopback test warning, recive too more test pkt\n"); + nicif_warn(nic_dev, rx_err, netdev, "Loopback test warning, recive too more test pkt\n"); }
if (skb->len != nic_dev->lb_pkt_len) { - nicif_warn(nic_dev, drv, netdev, "Wrong packet length\n"); + nicif_warn(nic_dev, rx_err, netdev, "Wrong packet length\n"); nic_dev->lb_test_rx_idx++; return; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.h b/drivers/net/ethernet/huawei/hinic/hinic_rx.h index 09f8784157cf..b6e8935c01d4 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.h @@ -37,8 +37,11 @@ struct hinic_rxq_stats { u64 csum_errors; u64 other_errors; u64 dropped; + u64 rx_buf_empty;
u64 alloc_skb_err; + u64 alloc_rx_buf_err; + u64 map_rx_buf_err;
struct u64_stats_sync syncp; };
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
When the driver incorporates new features, but the firmware is an old version, some commands are not supported by the firmware. After the driver sends the command, printing the error level log will mislead the user to think that there is an abnormality, so modify the print and log level.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Wangxiaoyun cloud.wangxiaoyun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_hwdev.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c index 1178e53be9c6..036ab76d714b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c @@ -655,7 +655,8 @@ static void __print_status_info(struct hinic_hwdev *dev, } }
-static bool hinic_status_need_special_handle(enum hinic_mod_type mod, +static bool hinic_status_need_special_handle(struct hinic_hwdev *dev, + enum hinic_mod_type mod, u8 cmd, u8 status) { if (mod == HINIC_MOD_L2NIC) { @@ -671,6 +672,17 @@ static bool hinic_status_need_special_handle(enum hinic_mod_type mod, return true; }
+ if (status == HINIC_MGMT_STATUS_ERR_UNSUPPORT) { + if (mod == HINIC_MOD_L2NIC) + sdk_warn(dev->dev_hdl, "Mgmt command: mod(0x%x) cmd(0x%x) not supported\n", + mod, cmd); + else + sdk_warn(dev->dev_hdl, "Mgmt command: mod(0x%x) cmd(0x%x) not supported\n", + mod, cmd); + + return true; + } + return false; }
@@ -693,7 +705,7 @@ static void hinic_print_status_info(void *hwdev, enum hinic_mod_type mod, if (!status) return;
- if (hinic_status_need_special_handle(mod, cmd, status)) + if (hinic_status_need_special_handle(dev, mod, cmd, status)) return;
size = ARRAY_SIZE(mgmt_status_log);
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
update hinic version to 2.3.2.17
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Wangxiaoyun cloud.wangxiaoyun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h index c7c78b2632da..1e6479a93ead 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h @@ -30,7 +30,7 @@ #define HINIC_DRV_NAME "hinic" #define HINIC_CHIP_NAME "hinic"
-#define HINIC_DRV_VERSION "2.3.2.16" +#define HINIC_DRV_VERSION "2.3.2.17" struct vf_data_storage;
#define HINIC_FUNC_IS_VF(hwdev) (hinic_func_type(hwdev) == TYPE_VF)