Lines Matching refs: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()
138 static void hns_ae_put_handle(struct hnae_handle *handle) in hns_ae_put_handle() argument
140 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_put_handle()
143 for (i = 0; i < handle->q_num; i++) in hns_ae_put_handle()
144 hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; in hns_ae_put_handle()
149 static int hns_ae_wait_flow_down(struct hnae_handle *handle) in hns_ae_wait_flow_down() argument
157 for (i = 0; i < handle->q_num; i++) { in hns_ae_wait_flow_down()
158 ret = hns_rcb_wait_tx_ring_clean(handle->qs[i]); in hns_ae_wait_flow_down()
163 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_wait_flow_down()
168 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_wait_flow_down()
171 ret = hns_dsaf_wait_pkt_clean(dsaf_dev, handle->dport_id); in hns_ae_wait_flow_down()
175 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_wait_flow_down()
184 static void hns_ae_ring_enable_all(struct hnae_handle *handle, int val) in hns_ae_ring_enable_all() argument
186 int q_num = handle->q_num; in hns_ae_ring_enable_all()
190 hns_rcb_ring_enable_hw(handle->qs[i], val); in hns_ae_ring_enable_all()
203 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(q->handle); in hns_ae_fini_queue()
209 static int hns_ae_set_mac_address(struct hnae_handle *handle, const void *p) in hns_ae_set_mac_address() argument
212 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mac_address()
215 dev_err(handle->owner_dev, "is not valid ether addr !\n"); in hns_ae_set_mac_address()
219 ret = hns_mac_change_vf_addr(mac_cb, handle->vf_id, p); in hns_ae_set_mac_address()
221 dev_err(handle->owner_dev, in hns_ae_set_mac_address()
229 static int hns_ae_add_uc_address(struct hnae_handle *handle, in hns_ae_add_uc_address() argument
232 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_add_uc_address()
237 return hns_mac_add_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_add_uc_address()
240 static int hns_ae_rm_uc_address(struct hnae_handle *handle, in hns_ae_rm_uc_address() argument
243 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_rm_uc_address()
248 return hns_mac_rm_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_rm_uc_address()
251 static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr) in hns_ae_set_multicast_one() argument
255 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_multicast_one()
265 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
271 ret = hns_mac_get_inner_port_num(mac_cb, handle->vf_id, &port_num); in hns_ae_set_multicast_one()
277 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
284 static int hns_ae_clr_multicast(struct hnae_handle *handle) in hns_ae_clr_multicast() argument
286 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_clr_multicast()
291 return hns_mac_clr_multicast(mac_cb, handle->vf_id); in hns_ae_clr_multicast()
294 static int hns_ae_set_mtu(struct hnae_handle *handle, int new_mtu) in hns_ae_set_mtu() argument
296 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mtu()
315 for (i = 0; i < handle->q_num; i++) { in hns_ae_set_mtu()
316 q = handle->qs[i]; in hns_ae_set_mtu()
325 static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable) in hns_ae_set_tso_stats() argument
327 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_tso_stats()
332 static int hns_ae_start(struct hnae_handle *handle) in hns_ae_start() argument
336 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_start()
342 for (k = 0; k < handle->q_num; k++) { in hns_ae_start()
344 hns_rcb_int_clr_hw(handle->qs[k], in hns_ae_start()
347 hns_rcbv2_int_clr_hw(handle->qs[k], in hns_ae_start()
350 hns_ae_ring_enable_all(handle, 1); in hns_ae_start()
358 static void hns_ae_stop(struct hnae_handle *handle) in hns_ae_stop() argument
360 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_stop()
363 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_TX); in hns_ae_stop()
371 hns_ae_ring_enable_all(handle, 0); in hns_ae_stop()
374 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_RX); in hns_ae_stop()
379 static void hns_ae_reset(struct hnae_handle *handle) in hns_ae_reset() argument
381 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_reset()
413 static int hns_ae_get_link_status(struct hnae_handle *handle) in hns_ae_get_link_status() argument
416 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_link_status()
423 static int hns_ae_get_mac_info(struct hnae_handle *handle, in hns_ae_get_mac_info() argument
426 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_mac_info()
431 static bool hns_ae_need_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_need_adjust_link() argument
434 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_need_adjust_link()
439 static void hns_ae_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_adjust_link() argument
442 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_adjust_link()
452 if (hns_ae_wait_flow_down(handle)) { in hns_ae_adjust_link()
472 static void hns_ae_get_pauseparam(struct hnae_handle *handle, in hns_ae_get_pauseparam() argument
475 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_pauseparam()
483 if (handle->port_type == HNAE_PORT_SERVICE) in hns_ae_get_pauseparam()
487 static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en) in hns_ae_set_promisc_mode() argument
489 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_promisc_mode()
491 hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en); in hns_ae_set_promisc_mode()
495 static int hns_ae_set_pauseparam(struct hnae_handle *handle, in hns_ae_set_pauseparam() argument
498 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_pauseparam()
507 if (handle->port_type == HNAE_PORT_SERVICE) { in hns_ae_set_pauseparam()
517 static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle, in hns_ae_get_coalesce_usecs() argument
521 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_coalesce_usecs()
529 static void hns_ae_get_max_coalesced_frames(struct hnae_handle *handle, in hns_ae_get_max_coalesced_frames() argument
533 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_max_coalesced_frames()
534 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_max_coalesced_frames()
537 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_max_coalesced_frames()
547 static int hns_ae_set_coalesce_usecs(struct hnae_handle *handle, in hns_ae_set_coalesce_usecs() argument
551 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_usecs()
557 static int hns_ae_set_coalesce_frames(struct hnae_handle *handle, in hns_ae_set_coalesce_frames() argument
562 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_frames()
563 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_set_coalesce_frames()
566 handle->port_type == HNAE_PORT_DEBUG) { in hns_ae_set_coalesce_frames()
587 static void hns_ae_get_coalesce_range(struct hnae_handle *handle, in hns_ae_get_coalesce_range() argument
595 assert(handle); in hns_ae_get_coalesce_range()
597 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_coalesce_range()
603 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_coalesce_range()
618 static void hns_ae_update_stats(struct hnae_handle *handle, in hns_ae_update_stats() argument
627 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_update_stats()
632 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_update_stats()
636 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_update_stats()
637 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_stats()
639 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_update_stats()
640 queue = handle->qs[idx]; in hns_ae_update_stats()
701 static void hns_ae_get_stats(struct hnae_handle *handle, u64 *data) in hns_ae_get_stats() argument
709 if (!handle || !data) { in hns_ae_get_stats()
714 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_stats()
715 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_stats()
716 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_stats()
718 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_stats()
719 hns_rcb_get_stats(handle->qs[idx], p); in hns_ae_get_stats()
733 static void hns_ae_get_strings(struct hnae_handle *handle, in hns_ae_get_strings() argument
740 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_strings()
744 assert(handle); in hns_ae_get_strings()
746 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_strings()
748 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_strings()
749 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_strings()
751 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_strings()
766 static int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset) in hns_ae_get_sset_count() argument
770 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_sset_count()
772 assert(handle); in hns_ae_get_sset_count()
774 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_sset_count()
776 sset_count += hns_rcb_get_ring_sset_count(stringset) * handle->q_num; in hns_ae_get_sset_count()
786 static int hns_ae_config_loopback(struct hnae_handle *handle, in hns_ae_config_loopback() argument
790 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_config_loopback()
791 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_config_loopback()
812 static void hns_ae_update_led_status(struct hnae_handle *handle) in hns_ae_update_led_status() argument
816 assert(handle); in hns_ae_update_led_status()
817 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_led_status()
824 static int hns_ae_cpld_set_led_id(struct hnae_handle *handle, in hns_ae_cpld_set_led_id() argument
829 assert(handle); in hns_ae_cpld_set_led_id()
831 mac_cb = hns_get_mac_cb(handle); in hns_ae_cpld_set_led_id()
836 static void hns_ae_get_regs(struct hnae_handle *handle, void *data) in hns_ae_get_regs() argument
840 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs()
841 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_regs()
849 for (i = 0; i < handle->q_num; i++) { in hns_ae_get_regs()
850 hns_rcb_get_ring_regs(handle->qs[i], p); in hns_ae_get_regs()
861 static int hns_ae_get_regs_len(struct hnae_handle *handle) in hns_ae_get_regs_len() argument
864 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs_len()
868 total_num += hns_rcb_get_ring_regs_count() * handle->q_num; in hns_ae_get_regs_len()
877 static u32 hns_ae_get_rss_key_size(struct hnae_handle *handle) in hns_ae_get_rss_key_size() argument
882 static u32 hns_ae_get_rss_indir_size(struct hnae_handle *handle) in hns_ae_get_rss_indir_size() argument
887 static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, in hns_ae_get_rss() argument
890 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_rss()
908 static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, in hns_ae_set_rss() argument
911 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_rss()