]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: hns3: optimize the maximum TC macro
authorliuzhongzhu <liuzhongzhu@huawei.com>
Sat, 2 Feb 2019 14:39:34 +0000 (22:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 Feb 2019 16:24:08 +0000 (08:24 -0800)
Multiple macros with the largest number of TCs in the system,
optimized to HCLGE_MAX_TC_NUM.

Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index e26a25128693b95eeb642c8ac69826d92488108f..ac2cd219a9fbd072c8e1bb33731fb098c17aa988 100644 (file)
@@ -312,16 +312,16 @@ struct hclge_ctrl_vector_chain_cmd {
        u8 rsv;
 };
 
-#define HCLGE_TC_NUM           8
+#define HCLGE_MAX_TC_NUM               8
 #define HCLGE_TC0_PRI_BUF_EN_B 15 /* Bit 15 indicate enable or not */
 #define HCLGE_BUF_UNIT_S       7  /* Buf size is united by 128 bytes */
 struct hclge_tx_buff_alloc_cmd {
-       __le16 tx_pkt_buff[HCLGE_TC_NUM];
+       __le16 tx_pkt_buff[HCLGE_MAX_TC_NUM];
        u8 tx_buff_rsv[8];
 };
 
 struct hclge_rx_priv_buff_cmd {
-       __le16 buf_num[HCLGE_TC_NUM];
+       __le16 buf_num[HCLGE_MAX_TC_NUM];
        __le16 shared_buf;
        u8 rsv[6];
 };
@@ -367,7 +367,6 @@ struct hclge_priv_buf {
        u32 enable;     /* Enable TC private buffer or not */
 };
 
-#define HCLGE_MAX_TC_NUM       8
 struct hclge_shared_buf {
        struct hclge_waterline self;
        struct hclge_tc_thrd tc_thrd[HCLGE_MAX_TC_NUM];
index 26d80504c730ff26ca59c7037819c5ed2250a6ef..1192cf6f2321dadcb80da2e4a168cbc248d1d76c 100644 (file)
@@ -691,7 +691,7 @@ static void hclge_dbg_dump_qos_buf_cfg(struct hclge_dev *hdev)
        dev_info(&hdev->pdev->dev, "dump qos buf cfg\n");
 
        tx_buf_cmd = (struct hclge_tx_buff_alloc_cmd *)desc[0].data;
-       for (i = 0; i < HCLGE_TC_NUM; i++)
+       for (i = 0; i < HCLGE_MAX_TC_NUM; i++)
                dev_info(&hdev->pdev->dev, "tx_packet_buf_tc_%d: 0x%x\n", i,
                         tx_buf_cmd->tx_pkt_buff[i]);
 
@@ -703,7 +703,7 @@ static void hclge_dbg_dump_qos_buf_cfg(struct hclge_dev *hdev)
 
        dev_info(&hdev->pdev->dev, "\n");
        rx_buf_cmd = (struct hclge_rx_priv_buff_cmd *)desc[0].data;
-       for (i = 0; i < HCLGE_TC_NUM; i++)
+       for (i = 0; i < HCLGE_MAX_TC_NUM; i++)
                dev_info(&hdev->pdev->dev, "rx_packet_buf_tc_%d: 0x%x\n", i,
                         rx_buf_cmd->buf_num[i]);
 
index 5f6fc23fab5df63d61e01e8476f683b101666afc..f55835dee5c77ad7b9291a9992f19312c8f5df02 100644 (file)
@@ -1331,7 +1331,7 @@ static int  hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev,
        req = (struct hclge_tx_buff_alloc_cmd *)desc.data;
 
        hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TX_BUFF_ALLOC, 0);
-       for (i = 0; i < HCLGE_TC_NUM; i++) {
+       for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
                u32 buf_size = buf_alloc->priv_buf[i].tx_buf_size;
 
                req->tx_pkt_buff[i] =