Lines Matching full:self

19 static int hw_atl2_act_rslvr_table_set(struct aq_hw_s *self, u8 location,
89 static u32 hw_atl2_sem_act_rslvr_get(struct aq_hw_s *self) in hw_atl2_sem_act_rslvr_get() argument
91 return hw_atl_reg_glb_cpu_sem_get(self, HW_ATL2_FW_SM_ACT_RSLVR); in hw_atl2_sem_act_rslvr_get()
94 static int hw_atl2_hw_reset(struct aq_hw_s *self) in hw_atl2_hw_reset() argument
96 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_reset()
99 err = hw_atl2_utils_soft_reset(self); in hw_atl2_hw_reset()
105 self->aq_fw_ops->set_state(self, MPI_RESET); in hw_atl2_hw_reset()
107 err = aq_hw_err_from_flags(self); in hw_atl2_hw_reset()
112 static int hw_atl2_hw_queue_to_tc_map_set(struct aq_hw_s *self) in hw_atl2_hw_queue_to_tc_map_set() argument
114 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; in hw_atl2_hw_queue_to_tc_map_set()
120 hw_atl2_tpb_tx_tc_q_rand_map_en_set(self, 1U); in hw_atl2_hw_queue_to_tc_map_set()
142 aq_hw_write_reg(self, in hw_atl2_hw_queue_to_tc_map_set()
151 aq_hw_write_reg(self, in hw_atl2_hw_queue_to_tc_map_set()
159 return aq_hw_err_from_flags(self); in hw_atl2_hw_queue_to_tc_map_set()
162 static int hw_atl2_hw_qos_set(struct aq_hw_s *self) in hw_atl2_hw_qos_set() argument
164 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; in hw_atl2_hw_qos_set()
171 hw_atl_tps_tx_pkt_shed_desc_rate_curr_time_res_set(self, 0x0U); in hw_atl2_hw_qos_set()
172 hw_atl_tps_tx_pkt_shed_desc_rate_lim_set(self, 0xA); in hw_atl2_hw_qos_set()
175 hw_atl_tps_tx_pkt_shed_desc_vm_arb_mode_set(self, 0U); in hw_atl2_hw_qos_set()
183 hw_atl_tpb_tx_pkt_buff_size_per_tc_set(self, tx_buff_size, tc); in hw_atl2_hw_qos_set()
186 hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(self, threshold, tc); in hw_atl2_hw_qos_set()
189 hw_atl_tpb_tx_buff_lo_threshold_per_tc_set(self, threshold, tc); in hw_atl2_hw_qos_set()
192 hw_atl_rpb_rx_pkt_buff_size_per_tc_set(self, rx_buff_size, tc); in hw_atl2_hw_qos_set()
195 hw_atl_rpb_rx_buff_hi_threshold_per_tc_set(self, threshold, tc); in hw_atl2_hw_qos_set()
198 hw_atl_rpb_rx_buff_lo_threshold_per_tc_set(self, threshold, tc); in hw_atl2_hw_qos_set()
200 hw_atl_b0_set_fc(self, self->aq_nic_cfg->fc.req, tc); in hw_atl2_hw_qos_set()
205 hw_atl_rpf_rpb_user_priority_tc_map_set(self, prio, in hw_atl2_hw_qos_set()
209 hw_atl2_hw_queue_to_tc_map_set(self); in hw_atl2_hw_qos_set()
211 return aq_hw_err_from_flags(self); in hw_atl2_hw_qos_set()
214 static int hw_atl2_hw_rss_set(struct aq_hw_s *self, in hw_atl2_hw_rss_set() argument
218 const u32 num_tcs = aq_hw_num_tcs(self); in hw_atl2_hw_rss_set()
225 hw_atl2_rpf_redirection_table2_select_set(self, rpf_redir2_enable); in hw_atl2_hw_rss_set()
229 hw_atl2_new_rpf_rss_redir_set(self, tc, i, in hw_atl2_hw_rss_set()
231 aq_hw_q_per_tc(self) + in hw_atl2_hw_rss_set()
236 return aq_hw_err_from_flags(self); in hw_atl2_hw_rss_set()
239 static int hw_atl2_hw_init_tx_tc_rate_limit(struct aq_hw_s *self) in hw_atl2_hw_init_tx_tc_rate_limit() argument
246 const u32 link_speed = self->aq_link_status.mbps; in hw_atl2_hw_init_tx_tc_rate_limit()
247 struct aq_nic_cfg_s *nic_cfg = self->aq_nic_cfg; in hw_atl2_hw_init_tx_tc_rate_limit()
287 hw_atl2_tps_tx_pkt_shed_data_arb_mode_set(self, min_rate_msk ? 1U : 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
291 hw_atl_tps_tx_pkt_shed_desc_tc_arb_mode_set(self, 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
293 hw_atl_tps_tx_desc_rate_mode_set(self, nic_cfg->is_qos ? 1U : 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
300 hw_atl_tps_tx_pkt_shed_desc_tc_max_credit_set(self, tc, in hw_atl2_hw_init_tx_tc_rate_limit()
302 hw_atl_tps_tx_pkt_shed_desc_tc_weight_set(self, tc, 0x1E); in hw_atl2_hw_init_tx_tc_rate_limit()
319 hw_atl2_tps_tx_pkt_shed_tc_data_weight_set(self, tc, weight); in hw_atl2_hw_init_tx_tc_rate_limit()
320 hw_atl2_tps_tx_pkt_shed_tc_data_max_credit_set(self, tc, in hw_atl2_hw_init_tx_tc_rate_limit()
323 hw_atl_tps_tx_desc_rate_en_set(self, desc, en); in hw_atl2_hw_init_tx_tc_rate_limit()
333 hw_atl_tps_tx_desc_rate_x_set(self, desc, rate_int); in hw_atl2_hw_init_tx_tc_rate_limit()
334 hw_atl_tps_tx_desc_rate_y_set(self, desc, rate_frac); in hw_atl2_hw_init_tx_tc_rate_limit()
339 hw_atl_tps_tx_desc_rate_x_set(self, desc, 1U); in hw_atl2_hw_init_tx_tc_rate_limit()
340 hw_atl_tps_tx_desc_rate_y_set(self, desc, 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
346 hw_atl_tps_tx_desc_rate_en_set(self, desc, 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
347 hw_atl_tps_tx_desc_rate_x_set(self, desc, 1U); in hw_atl2_hw_init_tx_tc_rate_limit()
348 hw_atl_tps_tx_desc_rate_y_set(self, desc, 0U); in hw_atl2_hw_init_tx_tc_rate_limit()
351 return aq_hw_err_from_flags(self); in hw_atl2_hw_init_tx_tc_rate_limit()
354 static int hw_atl2_hw_init_tx_path(struct aq_hw_s *self) in hw_atl2_hw_init_tx_path() argument
356 struct aq_nic_cfg_s *nic_cfg = self->aq_nic_cfg; in hw_atl2_hw_init_tx_path()
359 hw_atl_tpb_tps_tx_tc_mode_set(self, nic_cfg->tc_mode); in hw_atl2_hw_init_tx_path()
361 hw_atl_thm_lso_tcp_flag_of_first_pkt_set(self, 0x0FF6U); in hw_atl2_hw_init_tx_path()
362 hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(self, 0x0FF6U); in hw_atl2_hw_init_tx_path()
363 hw_atl_thm_lso_tcp_flag_of_last_pkt_set(self, 0x0F7FU); in hw_atl2_hw_init_tx_path()
366 hw_atl_tdm_tx_desc_wr_wb_irq_en_set(self, 1U); in hw_atl2_hw_init_tx_path()
369 hw_atl_tdm_tx_dca_en_set(self, 0U); in hw_atl2_hw_init_tx_path()
370 hw_atl_tdm_tx_dca_mode_set(self, 0U); in hw_atl2_hw_init_tx_path()
372 hw_atl_tpb_tx_path_scp_ins_en_set(self, 1U); in hw_atl2_hw_init_tx_path()
374 hw_atl2_tpb_tx_buf_clk_gate_en_set(self, 0U); in hw_atl2_hw_init_tx_path()
376 return aq_hw_err_from_flags(self); in hw_atl2_hw_init_tx_path()
379 static void hw_atl2_hw_init_new_rx_filters(struct aq_hw_s *self) in hw_atl2_hw_init_new_rx_filters() argument
381 u8 *prio_tc_map = self->aq_nic_cfg->prio_tc_map; in hw_atl2_hw_init_new_rx_filters()
382 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_init_new_rx_filters()
397 hw_atl2_rpf_act_rslvr_section_en_set(self, 0xFFFF); in hw_atl2_hw_init_new_rx_filters()
398 hw_atl2_rpfl2_uc_flr_tag_set(self, HW_ATL2_RPF_TAG_BASE_UC, in hw_atl2_hw_init_new_rx_filters()
400 hw_atl2_rpfl2_bc_flr_tag_set(self, HW_ATL2_RPF_TAG_BASE_UC); in hw_atl2_hw_init_new_rx_filters()
406 hw_atl2_act_rslvr_table_set(self, index, 0, in hw_atl2_hw_init_new_rx_filters()
412 hw_atl2_act_rslvr_table_set(self, index, 0, in hw_atl2_hw_init_new_rx_filters()
424 hw_atl2_act_rslvr_table_set(self, index, in hw_atl2_hw_init_new_rx_filters()
430 static void hw_atl2_hw_new_rx_filter_vlan_promisc(struct aq_hw_s *self, in hw_atl2_hw_new_rx_filter_vlan_promisc() argument
434 !hw_atl_rpfl2promiscuous_mode_en_get(self)) ? in hw_atl2_hw_new_rx_filter_vlan_promisc()
436 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_new_rx_filter_vlan_promisc()
440 hw_atl2_act_rslvr_table_set(self, index, 0, in hw_atl2_hw_new_rx_filter_vlan_promisc()
445 static void hw_atl2_hw_new_rx_filter_promisc(struct aq_hw_s *self, bool promisc) in hw_atl2_hw_new_rx_filter_promisc() argument
448 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_new_rx_filter_promisc()
453 hw_atl2_act_rslvr_table_set(self, index, 0, in hw_atl2_hw_new_rx_filter_promisc()
459 vlan_promisc_enable = hw_atl_rpf_vlan_prom_mode_en_get(self); in hw_atl2_hw_new_rx_filter_promisc()
460 hw_atl2_hw_new_rx_filter_vlan_promisc(self, promisc | in hw_atl2_hw_new_rx_filter_promisc()
464 static int hw_atl2_act_rslvr_table_set(struct aq_hw_s *self, u8 location, in hw_atl2_act_rslvr_table_set() argument
471 self, val, val == 1, in hw_atl2_act_rslvr_table_set()
476 hw_atl2_rpf_act_rslvr_record_set(self, location, tag, mask, in hw_atl2_act_rslvr_table_set()
479 hw_atl_reg_glb_cpu_sem_set(self, 1, HW_ATL2_FW_SM_ACT_RSLVR); in hw_atl2_act_rslvr_table_set()
484 static int hw_atl2_hw_init_rx_path(struct aq_hw_s *self) in hw_atl2_hw_init_rx_path() argument
486 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; in hw_atl2_hw_init_rx_path()
490 hw_atl_rpb_rpf_rx_traf_class_mode_set(self, cfg->tc_mode); in hw_atl2_hw_init_rx_path()
493 hw_atl_rpb_rx_flow_ctl_mode_set(self, 1U); in hw_atl2_hw_init_rx_path()
495 hw_atl2_rpf_rss_hash_type_set(self, HW_ATL2_RPF_RSS_HASH_TYPE_ALL); in hw_atl2_hw_init_rx_path()
498 hw_atl_b0_hw_init_rx_rss_ctrl1(self); in hw_atl2_hw_init_rx_path()
502 hw_atl_rpfl2_uc_flr_en_set(self, (i == 0U) ? 1U : 0U, i); in hw_atl2_hw_init_rx_path()
503 hw_atl_rpfl2unicast_flr_act_set(self, 1U, i); in hw_atl2_hw_init_rx_path()
506 hw_atl_reg_rx_flr_mcst_flr_msk_set(self, 0x00000000U); in hw_atl2_hw_init_rx_path()
507 hw_atl_reg_rx_flr_mcst_flr_set(self, HW_ATL_MCAST_FLT_ANY_TO_HOST, 0U); in hw_atl2_hw_init_rx_path()
510 hw_atl_rpf_vlan_outer_etht_set(self, ETH_P_8021AD); in hw_atl2_hw_init_rx_path()
511 hw_atl_rpf_vlan_inner_etht_set(self, ETH_P_8021Q); in hw_atl2_hw_init_rx_path()
513 hw_atl_rpf_vlan_prom_mode_en_set(self, 1); in hw_atl2_hw_init_rx_path()
516 hw_atl_rpf_vlan_accept_untagged_packets_set(self, 1U); in hw_atl2_hw_init_rx_path()
517 hw_atl_rpf_vlan_untagged_act_set(self, 1U); in hw_atl2_hw_init_rx_path()
519 hw_atl2_hw_init_new_rx_filters(self); in hw_atl2_hw_init_rx_path()
522 hw_atl_rdm_rx_desc_wr_wb_irq_en_set(self, 1U); in hw_atl2_hw_init_rx_path()
524 hw_atl_rpfl2broadcast_flr_act_set(self, 1U); in hw_atl2_hw_init_rx_path()
525 hw_atl_rpfl2broadcast_count_threshold_set(self, 0xFFFFU & (~0U / 256U)); in hw_atl2_hw_init_rx_path()
527 hw_atl_rdm_rx_dca_en_set(self, 0U); in hw_atl2_hw_init_rx_path()
528 hw_atl_rdm_rx_dca_mode_set(self, 0U); in hw_atl2_hw_init_rx_path()
530 return aq_hw_err_from_flags(self); in hw_atl2_hw_init_rx_path()
533 static int hw_atl2_hw_init(struct aq_hw_s *self, const u8 *mac_addr) in hw_atl2_hw_init() argument
542 struct aq_nic_cfg_s *aq_nic_cfg = self->aq_nic_cfg; in hw_atl2_hw_init()
543 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_init()
547 err = hw_atl2_utils_get_action_resolve_table_caps(self, &base_index, in hw_atl2_hw_init()
554 hw_atl2_init_launchtime(self); in hw_atl2_hw_init()
556 hw_atl2_hw_init_tx_path(self); in hw_atl2_hw_init()
557 hw_atl2_hw_init_rx_path(self); in hw_atl2_hw_init()
559 hw_atl_b0_hw_mac_addr_set(self, mac_addr); in hw_atl2_hw_init()
561 self->aq_fw_ops->set_link_speed(self, aq_nic_cfg->link_speed_msk); in hw_atl2_hw_init()
562 self->aq_fw_ops->set_state(self, MPI_INIT); in hw_atl2_hw_init()
564 hw_atl2_hw_qos_set(self); in hw_atl2_hw_init()
565 hw_atl2_hw_rss_set(self, &aq_nic_cfg->aq_rss); in hw_atl2_hw_init()
566 hw_atl_b0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss); in hw_atl2_hw_init()
568 hw_atl2_rpf_new_enable_set(self, 1); in hw_atl2_hw_init()
571 self->aq_link_status.mbps = 0; in hw_atl2_hw_init()
572 self->aq_fw_ops->update_stats(self); in hw_atl2_hw_init()
574 err = aq_hw_err_from_flags(self); in hw_atl2_hw_init()
579 hw_atl_reg_irq_glb_ctl_set(self, in hw_atl2_hw_init()
584 hw_atl_itr_irq_auto_masklsw_set(self, aq_nic_cfg->aq_hw_caps->irq_mask); in hw_atl2_hw_init()
587 hw_atl_reg_gen_irq_map_set(self, in hw_atl2_hw_init()
593 hw_atl_b0_hw_offload_set(self, aq_nic_cfg); in hw_atl2_hw_init()
599 static int hw_atl2_hw_ring_rx_init(struct aq_hw_s *self, in hw_atl2_hw_ring_rx_init() argument
603 return hw_atl_b0_hw_ring_rx_init(self, aq_ring, aq_ring_param); in hw_atl2_hw_ring_rx_init()
606 static int hw_atl2_hw_ring_tx_init(struct aq_hw_s *self, in hw_atl2_hw_ring_tx_init() argument
610 return hw_atl_b0_hw_ring_tx_init(self, aq_ring, aq_ring_param); in hw_atl2_hw_ring_tx_init()
615 static int hw_atl2_hw_packet_filter_set(struct aq_hw_s *self, in hw_atl2_hw_packet_filter_set() argument
618 hw_atl2_hw_new_rx_filter_promisc(self, IS_FILTER_ENABLED(IFF_PROMISC)); in hw_atl2_hw_packet_filter_set()
620 return hw_atl_b0_hw_packet_filter_set(self, packet_filter); in hw_atl2_hw_packet_filter_set()
625 static int hw_atl2_hw_multicast_list_set(struct aq_hw_s *self, in hw_atl2_hw_multicast_list_set() argument
631 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; in hw_atl2_hw_multicast_list_set()
646 hw_atl_rpfl2_uc_flr_en_set(self, 0U, HW_ATL2_MAC_MIN + i); in hw_atl2_hw_multicast_list_set()
648 hw_atl_rpfl2unicast_dest_addresslsw_set(self, l, in hw_atl2_hw_multicast_list_set()
651 hw_atl_rpfl2unicast_dest_addressmsw_set(self, h, in hw_atl2_hw_multicast_list_set()
654 hw_atl2_rpfl2_uc_flr_tag_set(self, 1, HW_ATL2_MAC_MIN + i); in hw_atl2_hw_multicast_list_set()
656 hw_atl_rpfl2_uc_flr_en_set(self, (cfg->is_mc_list_enabled), in hw_atl2_hw_multicast_list_set()
660 err = aq_hw_err_from_flags(self); in hw_atl2_hw_multicast_list_set()
666 static int hw_atl2_hw_interrupt_moderation_set(struct aq_hw_s *self) in hw_atl2_hw_interrupt_moderation_set() argument
672 switch (self->aq_nic_cfg->itr) { in hw_atl2_hw_interrupt_moderation_set()
675 hw_atl_tdm_tx_desc_wr_wb_irq_en_set(self, 0U); in hw_atl2_hw_interrupt_moderation_set()
676 hw_atl_tdm_tdm_intr_moder_en_set(self, 1U); in hw_atl2_hw_interrupt_moderation_set()
677 hw_atl_rdm_rx_desc_wr_wb_irq_en_set(self, 0U); in hw_atl2_hw_interrupt_moderation_set()
678 hw_atl_rdm_rdm_intr_moder_en_set(self, 1U); in hw_atl2_hw_interrupt_moderation_set()
680 if (self->aq_nic_cfg->itr == AQ_CFG_INTERRUPT_MODERATION_ON) { in hw_atl2_hw_interrupt_moderation_set()
682 int tx_max_timer = self->aq_nic_cfg->tx_itr / 2; in hw_atl2_hw_interrupt_moderation_set()
685 int rx_max_timer = self->aq_nic_cfg->rx_itr / 2; in hw_atl2_hw_interrupt_moderation_set()
718 unsigned int mbps = self->aq_link_status.mbps; in hw_atl2_hw_interrupt_moderation_set()
724 self->aq_nic_cfg->tx_itr = hw_atl2_timers_table_tx_ in hw_atl2_hw_interrupt_moderation_set()
726 self->aq_nic_cfg->rx_itr = hw_atl2_timers_table_rx_ in hw_atl2_hw_interrupt_moderation_set()
741 hw_atl_tdm_tx_desc_wr_wb_irq_en_set(self, 1U); in hw_atl2_hw_interrupt_moderation_set()
742 hw_atl_tdm_tdm_intr_moder_en_set(self, 0U); in hw_atl2_hw_interrupt_moderation_set()
743 hw_atl_rdm_rx_desc_wr_wb_irq_en_set(self, 1U); in hw_atl2_hw_interrupt_moderation_set()
744 hw_atl_rdm_rdm_intr_moder_en_set(self, 0U); in hw_atl2_hw_interrupt_moderation_set()
751 hw_atl2_reg_tx_intr_moder_ctrl_set(self, itr_tx, i); in hw_atl2_hw_interrupt_moderation_set()
752 hw_atl_reg_rx_intr_moder_ctrl_set(self, itr_rx, i); in hw_atl2_hw_interrupt_moderation_set()
755 return aq_hw_err_from_flags(self); in hw_atl2_hw_interrupt_moderation_set()
758 static int hw_atl2_hw_stop(struct aq_hw_s *self) in hw_atl2_hw_stop() argument
760 hw_atl_b0_hw_irq_disable(self, HW_ATL2_INT_MASK); in hw_atl2_hw_stop()
765 static struct aq_stats_s *hw_atl2_utils_get_hw_stats(struct aq_hw_s *self) in hw_atl2_utils_get_hw_stats() argument
767 return &self->curr_stats; in hw_atl2_utils_get_hw_stats()
770 static int hw_atl2_hw_vlan_set(struct aq_hw_s *self, in hw_atl2_hw_vlan_set() argument
773 struct hw_atl2_priv *priv = self->priv; in hw_atl2_hw_vlan_set()
778 hw_atl_rpf_vlan_prom_mode_en_set(self, 1U); in hw_atl2_hw_vlan_set()
783 hw_atl_rpf_vlan_flr_en_set(self, 0U, i); in hw_atl2_hw_vlan_set()
784 hw_atl_rpf_vlan_rxq_en_flr_set(self, 0U, i); in hw_atl2_hw_vlan_set()
786 hw_atl2_act_rslvr_table_set(self, index, 0, 0, in hw_atl2_hw_vlan_set()
789 hw_atl_rpf_vlan_id_flr_set(self, in hw_atl2_hw_vlan_set()
791 hw_atl_rpf_vlan_flr_act_set(self, 1U, i); in hw_atl2_hw_vlan_set()
792 hw_atl_rpf_vlan_flr_en_set(self, 1U, i); in hw_atl2_hw_vlan_set()
795 hw_atl_rpf_vlan_rxq_flr_set(self, in hw_atl2_hw_vlan_set()
798 hw_atl_rpf_vlan_rxq_en_flr_set(self, 1U, i); in hw_atl2_hw_vlan_set()
800 hw_atl2_rpf_vlan_flr_tag_set(self, i + 2, i); in hw_atl2_hw_vlan_set()
804 hw_atl2_act_rslvr_table_set(self, index, in hw_atl2_hw_vlan_set()
808 hw_atl2_rpf_vlan_flr_tag_set(self, 1, i); in hw_atl2_hw_vlan_set()
813 return aq_hw_err_from_flags(self); in hw_atl2_hw_vlan_set()
816 static int hw_atl2_hw_vlan_ctrl(struct aq_hw_s *self, bool enable) in hw_atl2_hw_vlan_ctrl() argument
819 hw_atl_rpf_vlan_prom_mode_en_set(self, !enable); in hw_atl2_hw_vlan_ctrl()
820 hw_atl2_hw_new_rx_filter_vlan_promisc(self, !enable); in hw_atl2_hw_vlan_ctrl()
822 return aq_hw_err_from_flags(self); in hw_atl2_hw_vlan_ctrl()