RDMA/hns: Optimize hns_roce_v2_set_mac()
authorLijun Ou <oulijun@huawei.com>
Wed, 15 Apr 2020 08:14:31 +0000 (16:14 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 24 Apr 2020 13:19:10 +0000 (10:19 -0300)
Removes the unnecessary memset opertaion and adjust style of some lines in
hns_roce_v2_set_mac().

Link: https://lore.kernel.org/r/1586938475-37049-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index dbbc5d4..0624d5a 100644 (file)
@@ -2427,12 +2427,9 @@ static int hns_roce_v2_set_mac(struct hns_roce_dev *hr_dev, u8 phy_port,
        reg_smac_l = *(u32 *)(&addr[0]);
        reg_smac_h = *(u16 *)(&addr[4]);
 
-       memset(smac_tb, 0, sizeof(*smac_tb));
-       roce_set_field(smac_tb->tb_idx_rsv,
-                      CFG_SMAC_TB_IDX_M,
+       roce_set_field(smac_tb->tb_idx_rsv, CFG_SMAC_TB_IDX_M,
                       CFG_SMAC_TB_IDX_S, phy_port);
-       roce_set_field(smac_tb->vf_smac_h_rsv,
-                      CFG_SMAC_TB_VF_SMAC_H_M,
+       roce_set_field(smac_tb->vf_smac_h_rsv, CFG_SMAC_TB_VF_SMAC_H_M,
                       CFG_SMAC_TB_VF_SMAC_H_S, reg_smac_h);
        smac_tb->vf_smac_l = cpu_to_le32(reg_smac_l);