diff options
author | Qianqian Xie <xieqianqian@huawei.com> | 2016-11-09 18:13:54 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-10 11:45:37 -0500 |
commit | 5483bfcb169cf3e68196bb6f28a43107fb48022c (patch) | |
tree | c2749792a58ed332235b2d2dfbeb8adf77fb0f5d /drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |
parent | d30721d459fb73a797f004b0d05e8eab2e7f1944 (diff) |
net: hns: modify tcam table and set mac key
The current definition of dsaf_drv_tbl_tcam_key is only suitable for
Little-endian. If data is stored in Big-endian, this may lead to
error in data use. Shift operation can make it work normally in both
Big-endian and Little-endian.
Signed-off-by: Qianqian Xie <xieqianqian@huawei.com>
Reviewed-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index 27214582fddb..db23eef1996b 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c @@ -1509,8 +1509,12 @@ static void hns_dsaf_set_mac_key( mac_key->high.bits.mac_3 = addr[3]; mac_key->low.bits.mac_4 = addr[4]; mac_key->low.bits.mac_5 = addr[5]; - mac_key->low.bits.vlan = vlan_id; - mac_key->low.bits.port = port; + dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_VLAN_M, + DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id); + dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M, + DSAF_TBL_TCAM_KEY_PORT_S, port); + + mac_key->low.bits.port_vlan = le16_to_cpu(mac_key->low.bits.port_vlan); } /** @@ -2760,8 +2764,12 @@ void hns_dsaf_set_promisc_tcam(struct dsaf_device *dsaf_dev, if (enable) { memset(&tbl_tcam_data, 0, sizeof(tbl_tcam_data)); memset(&tbl_tcam_mask, 0, sizeof(tbl_tcam_mask)); - tbl_tcam_data.low.bits.port = port; - tbl_tcam_mask.low.bits.port = 0xf; /* [3:0]: port id */ + dsaf_set_field(tbl_tcam_data.low.bits.port_vlan, + DSAF_TBL_TCAM_KEY_PORT_M, + DSAF_TBL_TCAM_KEY_PORT_S, port); + dsaf_set_field(tbl_tcam_mask.low.bits.port_vlan, + DSAF_TBL_TCAM_KEY_PORT_M, + DSAF_TBL_TCAM_KEY_PORT_S, 0xf); /* SUB_QID */ dsaf_set_bit(mac_data.tbl_mcast_port_msk[0], |