From: Chiqijun chiqijun@huawei.com
driver inclusion category: feature bugzilla: 4472
-----------------------------------------------------------------------
The previous hinic driver supports up to 64 queues, and the 1822 card provides a template for configuring 128 queues, so the driver needs to support 128 queues.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Zengweiliang zengweiliang.zengweiliang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_cfg.h | 2 +- .../huawei/hinic/hinic_mgmt_interface.h | 2 +- .../net/ethernet/huawei/hinic/hinic_nic_cfg.c | 4 +- .../net/ethernet/huawei/hinic/hinic_nic_cfg.h | 2 +- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 57 +------------------ drivers/net/ethernet/huawei/hinic/hinic_wq.c | 2 +- 6 files changed, 8 insertions(+), 61 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h index 212a9946137c..28b9c0c4b93e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h @@ -55,7 +55,7 @@ enum { #define L2NIC_SQ_DEPTH (4 * K_UNIT) #define L2NIC_RQ_DEPTH (4 * K_UNIT)
-#define HINIC_CFG_MAX_QP 64 +#define HINIC_CFG_MAX_QP 128
/* RDMA */ #define RDMA_RSVD_QPS 2 diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mgmt_interface.h b/drivers/net/ethernet/huawei/hinic/hinic_mgmt_interface.h index 8673cf545266..700642469732 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mgmt_interface.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_mgmt_interface.h @@ -462,7 +462,7 @@ struct hinic_set_rq_iq_mapping {
u16 func_id; u16 rsvd1; - u8 map[HINIC_MAX_NUM_RQ]; + u8 map[64]; u32 num_rqs; u32 rq_depth; }; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c index 7dfedbd01eed..fb94588daa30 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c @@ -1444,7 +1444,7 @@ int hinic_dcb_set_rq_iq_mapping(void *hwdev, u32 num_rqs, u8 *map) u16 out_size = sizeof(rq_iq_mapping); int err;
- if (!hwdev || !map || num_rqs > HINIC_MAX_NUM_RQ) + if (!hwdev || num_rqs > HINIC_MAX_NUM_RQ) return -EINVAL;
dev = hwdev; @@ -1459,8 +1459,6 @@ int hinic_dcb_set_rq_iq_mapping(void *hwdev, u32 num_rqs, u8 *map) rq_iq_mapping.num_rqs = num_rqs; rq_iq_mapping.rq_depth = (u16)ilog2(nic_io->rq_depth);
- memcpy(rq_iq_mapping.map, map, num_rqs); - err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_SET_RQ_IQ_MAP, &rq_iq_mapping, sizeof(rq_iq_mapping), &rq_iq_mapping, &out_size); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h index 243265072710..3d98c5a7246c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h @@ -36,7 +36,7 @@
#define HINIC_RSS_KEY_SIZE 40
-#define HINIC_MAX_NUM_RQ 64 +#define HINIC_MAX_NUM_RQ 128
#define HINIC_MIN_MTU_SIZE 256 #define HINIC_MAX_JUMBO_FRAME_SIZE 9600 diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index 8494e2128a54..c8cbcdfd5883 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -1016,51 +1016,6 @@ static void hinic_rss_deinit(struct hinic_nic_dev *nic_dev) hinic_rss_cfg(nic_dev->hwdev, 0, nic_dev->rss_tmpl_idx, 0, prio_tc); }
-/* In rx, iq means cos */ -static u8 hinic_get_iqmap_by_tc(u8 *prio_tc, u8 num_iq, u8 tc) -{ - u8 i, map = 0; - - for (i = 0; i < num_iq; i++) { - if (prio_tc[i] == tc) - map |= (u8)(1U << ((num_iq - 1) - i)); - } - - return map; -} - -static u8 hinic_get_tcid_by_rq(u32 *indir_tbl, u8 num_tcs, u16 rq_id) -{ - u16 tc_group_size; - int i; - - tc_group_size = HINIC_RSS_INDIR_SIZE / num_tcs; - for (i = 0; i < HINIC_RSS_INDIR_SIZE; i++) { - if (indir_tbl[i] == rq_id) - return (u8)(i / tc_group_size); - } - - return 0xFF; /* Invalid TC */ -} - -#define HINIC_NUM_IQ_PER_FUNC 8 -static void hinic_get_rq2iq_map(struct hinic_nic_dev *nic_dev, - u16 num_rq, u8 num_tcs, u8 *prio_tc, - u32 *indir_tbl, u8 *map) -{ - u16 qid; - u8 tc_id; - - if (!num_tcs) - num_tcs = 1; - - for (qid = 0; qid < num_rq; qid++) { - tc_id = hinic_get_tcid_by_rq(indir_tbl, num_tcs, qid); - map[qid] = hinic_get_iqmap_by_tc(prio_tc, - HINIC_NUM_IQ_PER_FUNC, tc_id); - } -} - int hinic_set_hw_rss_parameters(struct net_device *netdev, u8 rss_en, u8 num_tc, u8 *prio_tc) { @@ -1125,7 +1080,7 @@ int hinic_set_hw_rss_parameters(struct net_device *netdev, u8 rss_en, u8 num_tc, return err; }
-static int hinic_rss_init(struct hinic_nic_dev *nic_dev, u8 *rq2iq_map) +static int hinic_rss_init(struct hinic_nic_dev *nic_dev) { struct net_device *netdev = nic_dev->netdev; u32 *indir_tbl; @@ -1162,9 +1117,6 @@ static int hinic_rss_init(struct hinic_nic_dev *nic_dev, u8 *rq2iq_map) return err; }
- hinic_get_rq2iq_map(nic_dev, nic_dev->num_qps, num_tc, - prio_tc, indir_tbl, rq2iq_map); - kfree(indir_tbl); return 0; } @@ -1181,13 +1133,10 @@ int hinic_update_hw_tc_map(struct net_device *netdev, u8 num_tc, u8 *prio_tc) int hinic_rx_configure(struct net_device *netdev) { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); - u8 rq2iq_map[HINIC_MAX_NUM_RQ]; int err;
- /* Set all rq mapping to all iq in default */ - memset(rq2iq_map, 0xFF, sizeof(rq2iq_map)); if (test_bit(HINIC_RSS_ENABLE, &nic_dev->flags)) { - err = hinic_rss_init(nic_dev, rq2iq_map); + err = hinic_rss_init(nic_dev); if (err) { nicif_err(nic_dev, drv, netdev, "Failed to init rss\n"); return -EFAULT; @@ -1196,7 +1145,7 @@ int hinic_rx_configure(struct net_device *netdev)
err = hinic_dcb_set_rq_iq_mapping(nic_dev->hwdev, hinic_func_max_qnum(nic_dev->hwdev), - rq2iq_map); + NULL); if (err) { nicif_err(nic_dev, drv, netdev, "Failed to set rq_iq mapping\n"); goto set_rq_cos_mapping_err; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_wq.c index 06401a654629..4d8180c6b271 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_wq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_wq.c @@ -32,7 +32,7 @@ #include "hinic_wq.h" #include "hinic_qe_def.h"
-#define WQS_MAX_NUM_BLOCKS 128 +#define WQS_MAX_NUM_BLOCKS 256 #define WQS_FREE_BLOCKS_SIZE(wqs) (WQS_MAX_NUM_BLOCKS * \ sizeof((wqs)->free_blocks[0]))