diff options
author | yankejian <yankejian@huawei.com> | 2015-10-12 21:53:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-14 09:52:48 -0400 |
commit | 4568637f7a20bbb1dcbf8ada56de08f6c940bcbd (patch) | |
tree | 3fef8f6bced3c092ff614d1e49548cd59910804f /drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |
parent | 02a6d6136fa2a17f400a030829a6435556b3e65b (diff) |
net: hisilicon: supports promisc mode
this patch adds support to set promisc mode. it configs the queue on
init seq when it is on promisc mode.and being enabled or disabled promisc
mode by upper level user.
Signed-off-by: yankejian <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@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 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index 26ae6c64d74c..ffc2604766b6 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |||
@@ -217,6 +217,25 @@ hns_dsaf_ppe_qid_cfg(struct dsaf_device *dsaf_dev, u32 qid_cfg) | |||
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | static void hns_dsaf_mix_def_qid_cfg(struct dsaf_device *dsaf_dev) | ||
221 | { | ||
222 | u16 max_q_per_vf, max_vfn; | ||
223 | u32 q_id, q_num_per_port; | ||
224 | u32 i; | ||
225 | |||
226 | hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode, | ||
227 | HNS_DSAF_COMM_SERVICE_NW_IDX, | ||
228 | &max_vfn, &max_q_per_vf); | ||
229 | q_num_per_port = max_vfn * max_q_per_vf; | ||
230 | |||
231 | for (i = 0, q_id = 0; i < DSAF_SERVICE_NW_NUM; i++) { | ||
232 | dsaf_set_dev_field(dsaf_dev, | ||
233 | DSAF_MIX_DEF_QID_0_REG + 0x0004 * i, | ||
234 | 0xff, 0, q_id); | ||
235 | q_id += q_num_per_port; | ||
236 | } | ||
237 | } | ||
238 | |||
220 | /** | 239 | /** |
221 | * hns_dsaf_sw_port_type_cfg - cfg sw type | 240 | * hns_dsaf_sw_port_type_cfg - cfg sw type |
222 | * @dsaf_id: dsa fabric id | 241 | * @dsaf_id: dsa fabric id |
@@ -592,6 +611,11 @@ static void hns_dsaf_tbl_tcam_data_ucast_pul( | |||
592 | dsaf_write_dev(dsaf_dev, DSAF_TBL_PUL_0_REG, o_tbl_pul); | 611 | dsaf_write_dev(dsaf_dev, DSAF_TBL_PUL_0_REG, o_tbl_pul); |
593 | } | 612 | } |
594 | 613 | ||
614 | void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en) | ||
615 | { | ||
616 | dsaf_set_dev_bit(dsaf_dev, DSAF_CFG_0_REG, DSAF_CFG_MIX_MODE_S, !!en); | ||
617 | } | ||
618 | |||
595 | /** | 619 | /** |
596 | * hns_dsaf_tbl_stat_en - tbl | 620 | * hns_dsaf_tbl_stat_en - tbl |
597 | * @dsaf_id: dsa fabric id | 621 | * @dsaf_id: dsa fabric id |
@@ -920,6 +944,9 @@ static void hns_dsaf_comm_init(struct dsaf_device *dsaf_dev) | |||
920 | /* set 22 queue per tx ppe engine, only used in switch mode */ | 944 | /* set 22 queue per tx ppe engine, only used in switch mode */ |
921 | hns_dsaf_ppe_qid_cfg(dsaf_dev, DSAF_DEFAUTL_QUEUE_NUM_PER_PPE); | 945 | hns_dsaf_ppe_qid_cfg(dsaf_dev, DSAF_DEFAUTL_QUEUE_NUM_PER_PPE); |
922 | 946 | ||
947 | /* set promisc def queue id */ | ||
948 | hns_dsaf_mix_def_qid_cfg(dsaf_dev); | ||
949 | |||
923 | /* in non switch mode, set all port to access mode */ | 950 | /* in non switch mode, set all port to access mode */ |
924 | hns_dsaf_sw_port_type_cfg(dsaf_dev, DSAF_SW_PORT_TYPE_NON_VLAN); | 951 | hns_dsaf_sw_port_type_cfg(dsaf_dev, DSAF_SW_PORT_TYPE_NON_VLAN); |
925 | 952 | ||