Lines Matching full:handle
16 static struct hns_mac_cb *hns_get_mac_cb(struct hnae_handle *handle) in hns_get_mac_cb() argument
18 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_get_mac_cb()
28 static struct hns_ppe_cb *hns_get_ppe_cb(struct hnae_handle *handle) in hns_get_ppe_cb() argument
32 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_get_ppe_cb()
139 static void hns_ae_put_handle(struct hnae_handle *handle) in hns_ae_put_handle() argument
141 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_put_handle()
144 for (i = 0; i < handle->q_num; i++) in hns_ae_put_handle()
145 hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; in hns_ae_put_handle()
150 static int hns_ae_wait_flow_down(struct hnae_handle *handle) in hns_ae_wait_flow_down() argument
158 for (i = 0; i < handle->q_num; i++) { in hns_ae_wait_flow_down()
159 ret = hns_rcb_wait_tx_ring_clean(handle->qs[i]); in hns_ae_wait_flow_down()
164 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_wait_flow_down()
169 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_wait_flow_down()
172 ret = hns_dsaf_wait_pkt_clean(dsaf_dev, handle->dport_id); in hns_ae_wait_flow_down()
176 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_wait_flow_down()
185 static void hns_ae_ring_enable_all(struct hnae_handle *handle, int val) in hns_ae_ring_enable_all() argument
187 int q_num = handle->q_num; in hns_ae_ring_enable_all()
191 hns_rcb_ring_enable_hw(handle->qs[i], val); in hns_ae_ring_enable_all()
204 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(q->handle); in hns_ae_fini_queue()
210 static int hns_ae_set_mac_address(struct hnae_handle *handle, void *p) in hns_ae_set_mac_address() argument
213 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mac_address()
216 dev_err(handle->owner_dev, "is not valid ether addr !\n"); in hns_ae_set_mac_address()
220 ret = hns_mac_change_vf_addr(mac_cb, handle->vf_id, p); in hns_ae_set_mac_address()
222 dev_err(handle->owner_dev, in hns_ae_set_mac_address()
230 static int hns_ae_add_uc_address(struct hnae_handle *handle, in hns_ae_add_uc_address() argument
233 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_add_uc_address()
238 return hns_mac_add_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_add_uc_address()
241 static int hns_ae_rm_uc_address(struct hnae_handle *handle, in hns_ae_rm_uc_address() argument
244 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_rm_uc_address()
249 return hns_mac_rm_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_rm_uc_address()
252 static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr) in hns_ae_set_multicast_one() argument
256 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_multicast_one()
266 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
272 ret = hns_mac_get_inner_port_num(mac_cb, handle->vf_id, &port_num); in hns_ae_set_multicast_one()
278 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
285 static int hns_ae_clr_multicast(struct hnae_handle *handle) in hns_ae_clr_multicast() argument
287 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_clr_multicast()
292 return hns_mac_clr_multicast(mac_cb, handle->vf_id); in hns_ae_clr_multicast()
295 static int hns_ae_set_mtu(struct hnae_handle *handle, int new_mtu) in hns_ae_set_mtu() argument
297 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mtu()
316 for (i = 0; i < handle->q_num; i++) { in hns_ae_set_mtu()
317 q = handle->qs[i]; in hns_ae_set_mtu()
326 static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable) in hns_ae_set_tso_stats() argument
328 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_tso_stats()
333 static int hns_ae_start(struct hnae_handle *handle) in hns_ae_start() argument
337 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_start()
343 for (k = 0; k < handle->q_num; k++) { in hns_ae_start()
345 hns_rcb_int_clr_hw(handle->qs[k], in hns_ae_start()
348 hns_rcbv2_int_clr_hw(handle->qs[k], in hns_ae_start()
351 hns_ae_ring_enable_all(handle, 1); in hns_ae_start()
359 static void hns_ae_stop(struct hnae_handle *handle) in hns_ae_stop() argument
361 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_stop()
364 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_TX); in hns_ae_stop()
372 hns_ae_ring_enable_all(handle, 0); in hns_ae_stop()
375 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_RX); in hns_ae_stop()
380 static void hns_ae_reset(struct hnae_handle *handle) in hns_ae_reset() argument
382 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_reset()
414 static int hns_ae_get_link_status(struct hnae_handle *handle) in hns_ae_get_link_status() argument
417 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_link_status()
424 static int hns_ae_get_mac_info(struct hnae_handle *handle, in hns_ae_get_mac_info() argument
427 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_mac_info()
432 static bool hns_ae_need_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_need_adjust_link() argument
435 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_need_adjust_link()
440 static void hns_ae_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_adjust_link() argument
443 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_adjust_link()
453 if (hns_ae_wait_flow_down(handle)) { in hns_ae_adjust_link()
475 static void hns_ae_get_pauseparam(struct hnae_handle *handle, in hns_ae_get_pauseparam() argument
478 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_pauseparam()
486 if (handle->port_type == HNAE_PORT_SERVICE) in hns_ae_get_pauseparam()
490 static int hns_ae_set_autoneg(struct hnae_handle *handle, u8 enable) in hns_ae_set_autoneg() argument
492 assert(handle); in hns_ae_set_autoneg()
494 return hns_mac_set_autoneg(hns_get_mac_cb(handle), enable); in hns_ae_set_autoneg()
497 static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en) in hns_ae_set_promisc_mode() argument
499 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_promisc_mode()
501 hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en); in hns_ae_set_promisc_mode()
505 static int hns_ae_get_autoneg(struct hnae_handle *handle) in hns_ae_get_autoneg() argument
509 assert(handle); in hns_ae_get_autoneg()
511 hns_mac_get_autoneg(hns_get_mac_cb(handle), &auto_neg); in hns_ae_get_autoneg()
516 static int hns_ae_set_pauseparam(struct hnae_handle *handle, in hns_ae_set_pauseparam() argument
519 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_pauseparam()
528 if (handle->port_type == HNAE_PORT_SERVICE) { in hns_ae_set_pauseparam()
538 static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle, in hns_ae_get_coalesce_usecs() argument
542 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_coalesce_usecs()
550 static void hns_ae_get_max_coalesced_frames(struct hnae_handle *handle, in hns_ae_get_max_coalesced_frames() argument
554 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_max_coalesced_frames()
555 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_max_coalesced_frames()
558 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_max_coalesced_frames()
568 static int hns_ae_set_coalesce_usecs(struct hnae_handle *handle, in hns_ae_set_coalesce_usecs() argument
572 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_usecs()
578 static int hns_ae_set_coalesce_frames(struct hnae_handle *handle, in hns_ae_set_coalesce_frames() argument
583 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_frames()
584 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_set_coalesce_frames()
587 handle->port_type == HNAE_PORT_DEBUG) { in hns_ae_set_coalesce_frames()
608 static void hns_ae_get_coalesce_range(struct hnae_handle *handle, in hns_ae_get_coalesce_range() argument
616 assert(handle); in hns_ae_get_coalesce_range()
618 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_coalesce_range()
624 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_coalesce_range()
639 static void hns_ae_update_stats(struct hnae_handle *handle, in hns_ae_update_stats() argument
648 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_update_stats()
653 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_update_stats()
657 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_update_stats()
658 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_stats()
660 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_update_stats()
661 queue = handle->qs[idx]; in hns_ae_update_stats()
722 static void hns_ae_get_stats(struct hnae_handle *handle, u64 *data) in hns_ae_get_stats() argument
730 if (!handle || !data) { in hns_ae_get_stats()
731 pr_err("hns_ae_get_stats NULL handle or data pointer!\n"); in hns_ae_get_stats()
735 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_stats()
736 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_stats()
737 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_stats()
739 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_stats()
740 hns_rcb_get_stats(handle->qs[idx], p); in hns_ae_get_stats()
754 static void hns_ae_get_strings(struct hnae_handle *handle, in hns_ae_get_strings() argument
761 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_strings()
765 assert(handle); in hns_ae_get_strings()
767 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_strings()
769 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_strings()
770 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_strings()
772 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_strings()
787 static int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset) in hns_ae_get_sset_count() argument
791 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_sset_count()
793 assert(handle); in hns_ae_get_sset_count()
795 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_sset_count()
797 sset_count += hns_rcb_get_ring_sset_count(stringset) * handle->q_num; in hns_ae_get_sset_count()
807 static int hns_ae_config_loopback(struct hnae_handle *handle, in hns_ae_config_loopback() argument
811 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_config_loopback()
812 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_config_loopback()
833 static void hns_ae_update_led_status(struct hnae_handle *handle) in hns_ae_update_led_status() argument
837 assert(handle); in hns_ae_update_led_status()
838 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_led_status()
845 static int hns_ae_cpld_set_led_id(struct hnae_handle *handle, in hns_ae_cpld_set_led_id() argument
850 assert(handle); in hns_ae_cpld_set_led_id()
852 mac_cb = hns_get_mac_cb(handle); in hns_ae_cpld_set_led_id()
857 static void hns_ae_get_regs(struct hnae_handle *handle, void *data) in hns_ae_get_regs() argument
861 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs()
862 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_regs()
870 for (i = 0; i < handle->q_num; i++) { in hns_ae_get_regs()
871 hns_rcb_get_ring_regs(handle->qs[i], p); in hns_ae_get_regs()
882 static int hns_ae_get_regs_len(struct hnae_handle *handle) in hns_ae_get_regs_len() argument
885 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs_len()
889 total_num += hns_rcb_get_ring_regs_count() * handle->q_num; in hns_ae_get_regs_len()
898 static u32 hns_ae_get_rss_key_size(struct hnae_handle *handle) in hns_ae_get_rss_key_size() argument
903 static u32 hns_ae_get_rss_indir_size(struct hnae_handle *handle) in hns_ae_get_rss_indir_size() argument
908 static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, in hns_ae_get_rss() argument
911 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_rss()
929 static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, in hns_ae_set_rss() argument
932 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_rss()