From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC1D84404F; Wed, 12 Jun 2024 17:24:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D76D42FF3; Wed, 12 Jun 2024 17:06:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 4D44F42FB1 for ; Wed, 12 Jun 2024 17:06:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204812; x=1749740812; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WitVYL1yKlQXi4flqu84RpqDuXwRSkPOMTQ3UKYXuzk=; b=XY+sjt9W+Re6oC8ew2DvUlrm/bR6KGhbxr+5YtQRKlN+7k6PRGYfbKOP SlZdi3FrbbUNGWbkuJE9oj1xFG1D7uUkOerxgNcGlfJUx/SxcH9+tANQv Bjhre42jgnfdic6nWWb3t3XSSEYF7u84Wp3pmrVyZV2ndz1Z5hQ4m2JzU DalWdAaRUcWys7Tt0uIGcS0A7TaDoWhRj8mj3Z+fpHXibjzSoE+QPIoqE WAN24IdB9Q3eYCBLftoHwKIHmTTZHg0xmCyaZIHBaSejHx3nJ2p6inmgZ WECSaMwrftBQV6hCpii/JJagtaTkyqbXRSlIEy8fgGql6BQbUVLfeMd+X w==; X-CSE-ConnectionGUID: zeiUUrmnT0m3jB0vm/IXKw== X-CSE-MsgGUID: e1hNmz7IQk6zpQnIS3c8xg== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32460079" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32460079" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:06:49 -0700 X-CSE-ConnectionGUID: VdJHz5L6TzCJ8G/r6yr7mQ== X-CSE-MsgGUID: vv3R2VIsToeb6O77hzRejQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925955" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:06:48 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: ian.stokes@intel.com, bruce.richardson@intel.com Subject: [PATCH v2 126/148] net/ice/base: move code to common headers Date: Wed, 12 Jun 2024 16:02:00 +0100 Message-ID: <36990213f3f4afc163f20dc4fd8778244b7ac364.1718204529.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org To align with upstream release, move some code to common headers. Signed-off-by: Anatoly Burakov --- drivers/net/ice/base/ice_ptp_hw.c | 4 ++-- drivers/net/ice/base/ice_ptp_hw.h | 2 ++ drivers/net/ice/base/ice_sched.c | 8 +++---- drivers/net/ice/base/ice_sched.h | 18 ++++++++++++++++ drivers/net/ice/base/ice_switch.c | 17 ++++++--------- drivers/net/ice/base/ice_switch.h | 36 +++++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 17 deletions(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index 13bcd1de27..db0622e0fb 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -171,7 +171,7 @@ ice_write_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 val) * * Convert the specified TIME_REF clock frequency to a string. */ -static const char *ice_clk_freq_str(u8 clk_freq) +const char *ice_clk_freq_str(u8 clk_freq) { switch ((enum ice_time_ref_freq)clk_freq) { case ICE_TIME_REF_FREQ_25_000: @@ -197,7 +197,7 @@ static const char *ice_clk_freq_str(u8 clk_freq) * * Convert the specified clock source to its string name. */ -static const char *ice_clk_src_str(u8 clk_src) +const char *ice_clk_src_str(u8 clk_src) { switch ((enum ice_clk_src)clk_src) { case ICE_CLK_SRC_TCX0: diff --git a/drivers/net/ice/base/ice_ptp_hw.h b/drivers/net/ice/base/ice_ptp_hw.h index eb30d5534f..8030ebd0c1 100644 --- a/drivers/net/ice/base/ice_ptp_hw.h +++ b/drivers/net/ice/base/ice_ptp_hw.h @@ -188,6 +188,8 @@ ice_ptp_read_phy_incval_e822(struct ice_hw *hw, u8 port, u64 *incval); int ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port, u64 *tx_ts, u64 *rx_ts); +const char *ice_clk_freq_str(u8 clk_freq); +const char *ice_clk_src_str(u8 clk_src); void ice_ptp_reset_ts_memory_quad_e822(struct ice_hw *hw, u8 quad); int ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq, diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c index 478260c28d..353316cd0e 100644 --- a/drivers/net/ice/base/ice_sched.c +++ b/drivers/net/ice/base/ice_sched.c @@ -913,7 +913,7 @@ ice_aq_cfg_l2_node_cgd(struct ice_hw *hw, u16 num_l2_nodes, * * This function add nodes to HW as well as to SW DB for a given layer */ -static int +int ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node, struct ice_sched_node *parent, u8 layer, u16 num_nodes, u16 *num_nodes_added, u32 *first_node_teid, @@ -2277,7 +2277,7 @@ ice_sched_get_free_vsi_parent(struct ice_hw *hw, struct ice_sched_node *node, * This function removes the child from the old parent and adds it to a new * parent */ -static void +void ice_sched_update_parent(struct ice_sched_node *new_parent, struct ice_sched_node *node) { @@ -2311,7 +2311,7 @@ ice_sched_update_parent(struct ice_sched_node *new_parent, * * This function move the child nodes to a given parent. */ -static int +int ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, u16 num_items, u32 *list) { @@ -4382,7 +4382,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi, * node's RL profile ID of type CIR, EIR, or SRL, and removes old profile * ID from local database. The caller needs to hold scheduler lock. */ -static int +int ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, enum ice_rl_type rl_type, u32 bw, u8 layer_num) { diff --git a/drivers/net/ice/base/ice_sched.h b/drivers/net/ice/base/ice_sched.h index 51591bc6e7..0037cbf76f 100644 --- a/drivers/net/ice/base/ice_sched.h +++ b/drivers/net/ice/base/ice_sched.h @@ -105,6 +105,21 @@ ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req, int ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node, enum ice_rl_type rl_type, u32 bw); + +int +ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, + enum ice_rl_type rl_type, u32 bw, u8 layer_num); + +int +ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node, + struct ice_sched_node *parent, u8 layer, u16 num_nodes, + u16 *num_nodes_added, u32 *first_node_teid, + struct ice_sched_node **prealloc_node); + +int +ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, + u16 num_items, u32 *list); + int ice_sched_init_port(struct ice_port_info *pi); int ice_sched_query_res_alloc(struct ice_hw *hw); void ice_sched_get_psm_clk_freq(struct ice_hw *hw); @@ -123,6 +138,9 @@ int ice_sched_add_node(struct ice_port_info *pi, u8 layer, struct ice_aqc_txsched_elem_data *info, struct ice_sched_node *prealloc_node); +void +ice_sched_update_parent(struct ice_sched_node *new_parent, + struct ice_sched_node *node); void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node); struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc); struct ice_sched_node * diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 0b946444ee..b8aa1f2a72 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -38,11 +38,6 @@ static const u8 dummy_eth_header[DUMMY_ETH_HDR_LEN] = { 0x2, 0, 0, 0, 0, 0, 0x2, 0, 0, 0, 0, 0, 0x81, 0, 0, 0}; -struct ice_dummy_pkt_offsets { - enum ice_protocol_type type; - u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */ -}; - static const struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, @@ -4927,7 +4922,7 @@ ice_find_rule_entry(struct LIST_HEAD_TYPE *list_head, * handle element. This can be extended further to search VSI list with more * than 1 vsi_count. Returns pointer to VSI list entry if found. */ -static struct ice_vsi_list_map_info * +struct ice_vsi_list_map_info * ice_find_vsi_list_entry(struct ice_sw_recipe *recp_list, u16 vsi_handle, u16 *vsi_list_id) { @@ -8388,7 +8383,7 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type) * @rinfo: other information regarding the rule e.g. priority and action info * @rid: return the recipe ID of the recipe created */ -static int +int ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, struct ice_adv_rule_info *rinfo, u16 *rid) { @@ -8620,7 +8615,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, * @pkt_len: packet length of dummy packet * @offsets: pointer to receive the pointer to the offsets for the packet */ -static void +void ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, enum ice_sw_tunnel_type tun_type, const u8 **pkt, u16 *pkt_len, @@ -9151,7 +9146,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, * @pkt_len: packet length of dummy packet * @offsets: offset info for the dummy packet */ -static int +int ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, struct ice_sw_rule_lkup_rx_tx *s_rule, const u8 *dummy_pkt, u16 pkt_len, @@ -9364,7 +9359,7 @@ ice_fill_adv_packet_vlan(u16 vlan_type, u8 *pkt, * Helper function to search for a given advance rule entry * Returns pointer to entry storing the rule if found */ -static struct ice_adv_fltr_mgmt_list_entry * +struct ice_adv_fltr_mgmt_list_entry * ice_find_adv_rule_entry(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, u16 recp_id, struct ice_adv_rule_info *rinfo) @@ -9415,7 +9410,7 @@ ice_find_adv_rule_entry(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, * Add the new VSI to the previously created VSI list set * using the update switch rule command */ -static int +int ice_adv_add_update_vsi_list(struct ice_hw *hw, struct ice_adv_fltr_mgmt_list_entry *m_entry, struct ice_adv_rule_info *cur_fltr, diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 550b8a947b..0611c9af59 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -438,6 +438,42 @@ enum ice_promisc_flags { ICE_PROMISC_MAX, }; +struct ice_dummy_pkt_offsets { + enum ice_protocol_type type; + u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */ +}; + +void +ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, + enum ice_sw_tunnel_type tun_type, const u8 **pkt, + u16 *pkt_len, + const struct ice_dummy_pkt_offsets **offsets); + +int +ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, + struct ice_sw_rule_lkup_rx_tx *s_rule, + const u8 *dummy_pkt, u16 pkt_len, + const struct ice_dummy_pkt_offsets *offsets); + +int +ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, + u16 lkups_cnt, struct ice_adv_rule_info *rinfo, u16 *rid); + +struct ice_adv_fltr_mgmt_list_entry * +ice_find_adv_rule_entry(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, + u16 lkups_cnt, u16 recp_id, + struct ice_adv_rule_info *rinfo); + +int +ice_adv_add_update_vsi_list(struct ice_hw *hw, + struct ice_adv_fltr_mgmt_list_entry *m_entry, + struct ice_adv_rule_info *cur_fltr, + struct ice_adv_rule_info *new_fltr); + +struct ice_vsi_list_map_info * +ice_find_vsi_list_entry(struct ice_sw_recipe *recp_list, u16 vsi_handle, + u16 *vsi_list_id); + /* VSI related commands */ int ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, -- 2.43.0