Lines Matching full:handle
18 static struct hns_mac_cb *hns_get_mac_cb(struct hnae_handle *handle) in hns_get_mac_cb() argument
20 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_get_mac_cb()
30 static struct hns_ppe_cb *hns_get_ppe_cb(struct hnae_handle *handle) in hns_get_ppe_cb() argument
34 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_get_ppe_cb()
141 static void hns_ae_put_handle(struct hnae_handle *handle) in hns_ae_put_handle() argument
143 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_put_handle()
146 for (i = 0; i < handle->q_num; i++) in hns_ae_put_handle()
147 hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; in hns_ae_put_handle()
152 static int hns_ae_wait_flow_down(struct hnae_handle *handle) in hns_ae_wait_flow_down() argument
160 for (i = 0; i < handle->q_num; i++) { in hns_ae_wait_flow_down()
161 ret = hns_rcb_wait_tx_ring_clean(handle->qs[i]); in hns_ae_wait_flow_down()
166 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_wait_flow_down()
171 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_wait_flow_down()
174 ret = hns_dsaf_wait_pkt_clean(dsaf_dev, handle->dport_id); in hns_ae_wait_flow_down()
178 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_wait_flow_down()
187 static void hns_ae_ring_enable_all(struct hnae_handle *handle, int val) in hns_ae_ring_enable_all() argument
189 int q_num = handle->q_num; in hns_ae_ring_enable_all()
193 hns_rcb_ring_enable_hw(handle->qs[i], val); in hns_ae_ring_enable_all()
206 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(q->handle); in hns_ae_fini_queue()
212 static int hns_ae_set_mac_address(struct hnae_handle *handle, void *p) in hns_ae_set_mac_address() argument
215 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mac_address()
218 dev_err(handle->owner_dev, "is not valid ether addr !\n"); in hns_ae_set_mac_address()
222 ret = hns_mac_change_vf_addr(mac_cb, handle->vf_id, p); in hns_ae_set_mac_address()
224 dev_err(handle->owner_dev, in hns_ae_set_mac_address()
232 static int hns_ae_add_uc_address(struct hnae_handle *handle, in hns_ae_add_uc_address() argument
235 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_add_uc_address()
240 return hns_mac_add_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_add_uc_address()
243 static int hns_ae_rm_uc_address(struct hnae_handle *handle, in hns_ae_rm_uc_address() argument
246 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_rm_uc_address()
251 return hns_mac_rm_uc_addr(mac_cb, handle->vf_id, addr); in hns_ae_rm_uc_address()
254 static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr) in hns_ae_set_multicast_one() argument
258 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_multicast_one()
268 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
274 ret = hns_mac_get_inner_port_num(mac_cb, handle->vf_id, &port_num); in hns_ae_set_multicast_one()
280 dev_err(handle->owner_dev, in hns_ae_set_multicast_one()
287 static int hns_ae_clr_multicast(struct hnae_handle *handle) in hns_ae_clr_multicast() argument
289 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_clr_multicast()
294 return hns_mac_clr_multicast(mac_cb, handle->vf_id); in hns_ae_clr_multicast()
297 static int hns_ae_set_mtu(struct hnae_handle *handle, int new_mtu) in hns_ae_set_mtu() argument
299 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_mtu()
318 for (i = 0; i < handle->q_num; i++) { in hns_ae_set_mtu()
319 q = handle->qs[i]; in hns_ae_set_mtu()
328 static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable) in hns_ae_set_tso_stats() argument
330 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_tso_stats()
335 static int hns_ae_start(struct hnae_handle *handle) in hns_ae_start() argument
339 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_start()
345 for (k = 0; k < handle->q_num; k++) { in hns_ae_start()
347 hns_rcb_int_clr_hw(handle->qs[k], in hns_ae_start()
350 hns_rcbv2_int_clr_hw(handle->qs[k], in hns_ae_start()
353 hns_ae_ring_enable_all(handle, 1); in hns_ae_start()
361 static void hns_ae_stop(struct hnae_handle *handle) in hns_ae_stop() argument
363 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_stop()
366 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_TX); in hns_ae_stop()
374 hns_ae_ring_enable_all(handle, 0); in hns_ae_stop()
377 hns_rcb_wait_fbd_clean(handle->qs, handle->q_num, RCB_INT_FLAG_RX); in hns_ae_stop()
382 static void hns_ae_reset(struct hnae_handle *handle) in hns_ae_reset() argument
384 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_reset()
416 static int hns_ae_get_link_status(struct hnae_handle *handle) in hns_ae_get_link_status() argument
419 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_link_status()
426 static int hns_ae_get_mac_info(struct hnae_handle *handle, in hns_ae_get_mac_info() argument
429 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_mac_info()
434 static bool hns_ae_need_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_need_adjust_link() argument
437 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_need_adjust_link()
442 static void hns_ae_adjust_link(struct hnae_handle *handle, int speed, in hns_ae_adjust_link() argument
445 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_adjust_link()
455 if (hns_ae_wait_flow_down(handle)) { in hns_ae_adjust_link()
477 static void hns_ae_get_pauseparam(struct hnae_handle *handle, in hns_ae_get_pauseparam() argument
480 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_get_pauseparam()
488 if (handle->port_type == HNAE_PORT_SERVICE) in hns_ae_get_pauseparam()
492 static int hns_ae_set_autoneg(struct hnae_handle *handle, u8 enable) in hns_ae_set_autoneg() argument
494 assert(handle); in hns_ae_set_autoneg()
496 return hns_mac_set_autoneg(hns_get_mac_cb(handle), enable); in hns_ae_set_autoneg()
499 static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en) in hns_ae_set_promisc_mode() argument
501 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_promisc_mode()
503 hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en); in hns_ae_set_promisc_mode()
507 static int hns_ae_get_autoneg(struct hnae_handle *handle) in hns_ae_get_autoneg() argument
511 assert(handle); in hns_ae_get_autoneg()
513 hns_mac_get_autoneg(hns_get_mac_cb(handle), &auto_neg); in hns_ae_get_autoneg()
518 static int hns_ae_set_pauseparam(struct hnae_handle *handle, in hns_ae_set_pauseparam() argument
521 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_set_pauseparam()
530 if (handle->port_type == HNAE_PORT_SERVICE) { in hns_ae_set_pauseparam()
540 static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle, in hns_ae_get_coalesce_usecs() argument
544 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_coalesce_usecs()
552 static void hns_ae_get_max_coalesced_frames(struct hnae_handle *handle, in hns_ae_get_max_coalesced_frames() argument
556 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_get_max_coalesced_frames()
557 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_max_coalesced_frames()
560 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_max_coalesced_frames()
570 static int hns_ae_set_coalesce_usecs(struct hnae_handle *handle, in hns_ae_set_coalesce_usecs() argument
574 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_usecs()
580 static int hns_ae_set_coalesce_frames(struct hnae_handle *handle, in hns_ae_set_coalesce_frames() argument
585 container_of(handle->qs[0], struct ring_pair_cb, q); in hns_ae_set_coalesce_frames()
586 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_set_coalesce_frames()
589 handle->port_type == HNAE_PORT_DEBUG) { in hns_ae_set_coalesce_frames()
610 static void hns_ae_get_coalesce_range(struct hnae_handle *handle, in hns_ae_get_coalesce_range() argument
618 assert(handle); in hns_ae_get_coalesce_range()
620 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_coalesce_range()
626 handle->port_type == HNAE_PORT_DEBUG) in hns_ae_get_coalesce_range()
641 static void hns_ae_update_stats(struct hnae_handle *handle, in hns_ae_update_stats() argument
650 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_update_stats()
655 dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_update_stats()
659 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_update_stats()
660 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_stats()
662 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_update_stats()
663 queue = handle->qs[idx]; in hns_ae_update_stats()
724 static void hns_ae_get_stats(struct hnae_handle *handle, u64 *data) in hns_ae_get_stats() argument
732 if (!handle || !data) { in hns_ae_get_stats()
733 pr_err("hns_ae_get_stats NULL handle or data pointer!\n"); in hns_ae_get_stats()
737 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_stats()
738 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_stats()
739 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_stats()
741 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_stats()
742 hns_rcb_get_stats(handle->qs[idx], p); in hns_ae_get_stats()
756 static void hns_ae_get_strings(struct hnae_handle *handle, in hns_ae_get_strings() argument
763 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_strings()
767 assert(handle); in hns_ae_get_strings()
769 vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_strings()
771 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_strings()
772 ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_strings()
774 for (idx = 0; idx < handle->q_num; idx++) { in hns_ae_get_strings()
789 static int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset) in hns_ae_get_sset_count() argument
793 struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev); in hns_ae_get_sset_count()
795 assert(handle); in hns_ae_get_sset_count()
797 mac_cb = hns_get_mac_cb(handle); in hns_ae_get_sset_count()
799 sset_count += hns_rcb_get_ring_sset_count(stringset) * handle->q_num; in hns_ae_get_sset_count()
809 static int hns_ae_config_loopback(struct hnae_handle *handle, in hns_ae_config_loopback() argument
813 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_config_loopback()
814 struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); in hns_ae_config_loopback()
835 static void hns_ae_update_led_status(struct hnae_handle *handle) in hns_ae_update_led_status() argument
839 assert(handle); in hns_ae_update_led_status()
840 mac_cb = hns_get_mac_cb(handle); in hns_ae_update_led_status()
847 static int hns_ae_cpld_set_led_id(struct hnae_handle *handle, in hns_ae_cpld_set_led_id() argument
852 assert(handle); in hns_ae_cpld_set_led_id()
854 mac_cb = hns_get_mac_cb(handle); in hns_ae_cpld_set_led_id()
859 static void hns_ae_get_regs(struct hnae_handle *handle, void *data) in hns_ae_get_regs() argument
863 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs()
864 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_regs()
872 for (i = 0; i < handle->q_num; i++) { in hns_ae_get_regs()
873 hns_rcb_get_ring_regs(handle->qs[i], p); in hns_ae_get_regs()
884 static int hns_ae_get_regs_len(struct hnae_handle *handle) in hns_ae_get_regs_len() argument
887 struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); in hns_ae_get_regs_len()
891 total_num += hns_rcb_get_ring_regs_count() * handle->q_num; in hns_ae_get_regs_len()
900 static u32 hns_ae_get_rss_key_size(struct hnae_handle *handle) in hns_ae_get_rss_key_size() argument
905 static u32 hns_ae_get_rss_indir_size(struct hnae_handle *handle) in hns_ae_get_rss_indir_size() argument
910 static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, in hns_ae_get_rss() argument
913 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_get_rss()
931 static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, in hns_ae_set_rss() argument
934 struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); in hns_ae_set_rss()