diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hnae.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 27 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_enet.c | 17 |
7 files changed, 55 insertions, 3 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h index d4a1eb1b8e54..cec95ac8687d 100644 --- a/drivers/net/ethernet/hisilicon/hns/hnae.h +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h | |||
@@ -430,6 +430,7 @@ struct hnae_ae_ops { | |||
430 | void (*set_coalesce_usecs)(struct hnae_handle *handle, u32 timeout); | 430 | void (*set_coalesce_usecs)(struct hnae_handle *handle, u32 timeout); |
431 | int (*set_coalesce_frames)(struct hnae_handle *handle, | 431 | int (*set_coalesce_frames)(struct hnae_handle *handle, |
432 | u32 coalesce_frames); | 432 | u32 coalesce_frames); |
433 | void (*set_promisc_mode)(struct hnae_handle *handle, u32 en); | ||
433 | int (*get_mac_addr)(struct hnae_handle *handle, void **p); | 434 | int (*get_mac_addr)(struct hnae_handle *handle, void **p); |
434 | int (*set_mac_addr)(struct hnae_handle *handle, void *p); | 435 | int (*set_mac_addr)(struct hnae_handle *handle, void *p); |
435 | int (*set_mc_addr)(struct hnae_handle *handle, void *addr); | 436 | int (*set_mc_addr)(struct hnae_handle *handle, void *addr); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c index a2c72f84e397..1a16c0307b47 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | |||
@@ -392,6 +392,11 @@ static int hns_ae_set_autoneg(struct hnae_handle *handle, u8 enable) | |||
392 | return hns_mac_set_autoneg(hns_get_mac_cb(handle), enable); | 392 | return hns_mac_set_autoneg(hns_get_mac_cb(handle), enable); |
393 | } | 393 | } |
394 | 394 | ||
395 | static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en) | ||
396 | { | ||
397 | hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en); | ||
398 | } | ||
399 | |||
395 | static int hns_ae_get_autoneg(struct hnae_handle *handle) | 400 | static int hns_ae_get_autoneg(struct hnae_handle *handle) |
396 | { | 401 | { |
397 | u32 auto_neg; | 402 | u32 auto_neg; |
@@ -748,6 +753,7 @@ static struct hnae_ae_ops hns_dsaf_ops = { | |||
748 | .get_rx_max_coalesced_frames = hns_ae_get_rx_max_coalesced_frames, | 753 | .get_rx_max_coalesced_frames = hns_ae_get_rx_max_coalesced_frames, |
749 | .set_coalesce_usecs = hns_ae_set_coalesce_usecs, | 754 | .set_coalesce_usecs = hns_ae_set_coalesce_usecs, |
750 | .set_coalesce_frames = hns_ae_set_coalesce_frames, | 755 | .set_coalesce_frames = hns_ae_set_coalesce_frames, |
756 | .set_promisc_mode = hns_ae_set_promisc_mode, | ||
751 | .set_mac_addr = hns_ae_set_mac_address, | 757 | .set_mac_addr = hns_ae_set_mac_address, |
752 | .set_mc_addr = hns_ae_set_multicast_one, | 758 | .set_mc_addr = hns_ae_set_multicast_one, |
753 | .set_mtu = hns_ae_set_mtu, | 759 | .set_mtu = hns_ae_set_mtu, |
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 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h index 315b07ecd291..b2b93484995c 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | |||
@@ -423,5 +423,6 @@ void hns_dsaf_get_strings(int stringset, u8 *data, int port); | |||
423 | 423 | ||
424 | void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data); | 424 | void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data); |
425 | int hns_dsaf_get_regs_count(void); | 425 | int hns_dsaf_get_regs_count(void); |
426 | void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en); | ||
426 | 427 | ||
427 | #endif /* __HNS_DSAF_MAIN_H__ */ | 428 | #endif /* __HNS_DSAF_MAIN_H__ */ |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c index 05ea244d999c..4db32c62f062 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | |||
@@ -575,8 +575,8 @@ int hns_rcb_set_coalesced_frames(struct dsaf_device *dsaf_dev, | |||
575 | *@max_vfn : max vfn number | 575 | *@max_vfn : max vfn number |
576 | *@max_q_per_vf:max ring number per vm | 576 | *@max_q_per_vf:max ring number per vm |
577 | */ | 577 | */ |
578 | static void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, int comm_index, | 578 | void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, int comm_index, |
579 | u16 *max_vfn, u16 *max_q_per_vf) | 579 | u16 *max_vfn, u16 *max_q_per_vf) |
580 | { | 580 | { |
581 | if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { | 581 | if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { |
582 | switch (dsaf_mode) { | 582 | switch (dsaf_mode) { |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h index c7db6130a3cf..3a2afe2dd8bb 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | |||
@@ -107,6 +107,8 @@ int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common); | |||
107 | void hns_rcb_start(struct hnae_queue *q, u32 val); | 107 | void hns_rcb_start(struct hnae_queue *q, u32 val); |
108 | void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common); | 108 | void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common); |
109 | void hns_rcb_common_init_commit_hw(struct rcb_common_cb *rcb_common); | 109 | void hns_rcb_common_init_commit_hw(struct rcb_common_cb *rcb_common); |
110 | void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, int comm_index, | ||
111 | u16 *max_vfn, u16 *max_q_per_vf); | ||
110 | 112 | ||
111 | void hns_rcb_ring_enable_hw(struct hnae_queue *q, u32 val); | 113 | void hns_rcb_ring_enable_hw(struct hnae_queue *q, u32 val); |
112 | void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag); | 114 | void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index ce7f2e0e3fd1..6f9091c29869 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
@@ -1161,6 +1161,21 @@ void hns_set_multicast_list(struct net_device *ndev) | |||
1161 | } | 1161 | } |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | void hns_nic_set_rx_mode(struct net_device *ndev) | ||
1165 | { | ||
1166 | struct hns_nic_priv *priv = netdev_priv(ndev); | ||
1167 | struct hnae_handle *h = priv->ae_handle; | ||
1168 | |||
1169 | if (h->dev->ops->set_promisc_mode) { | ||
1170 | if (ndev->flags & IFF_PROMISC) | ||
1171 | h->dev->ops->set_promisc_mode(h, 1); | ||
1172 | else | ||
1173 | h->dev->ops->set_promisc_mode(h, 0); | ||
1174 | } | ||
1175 | |||
1176 | hns_set_multicast_list(ndev); | ||
1177 | } | ||
1178 | |||
1164 | struct rtnl_link_stats64 *hns_nic_get_stats64(struct net_device *ndev, | 1179 | struct rtnl_link_stats64 *hns_nic_get_stats64(struct net_device *ndev, |
1165 | struct rtnl_link_stats64 *stats) | 1180 | struct rtnl_link_stats64 *stats) |
1166 | { | 1181 | { |
@@ -1220,7 +1235,7 @@ static const struct net_device_ops hns_nic_netdev_ops = { | |||
1220 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1235 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1221 | .ndo_poll_controller = hns_nic_poll_controller, | 1236 | .ndo_poll_controller = hns_nic_poll_controller, |
1222 | #endif | 1237 | #endif |
1223 | .ndo_set_rx_mode = hns_set_multicast_list, | 1238 | .ndo_set_rx_mode = hns_nic_set_rx_mode, |
1224 | }; | 1239 | }; |
1225 | 1240 | ||
1226 | static void hns_nic_update_link_status(struct net_device *netdev) | 1241 | static void hns_nic_update_link_status(struct net_device *netdev) |