net/ice/base: support GTPU uplink and downlink
[dpdk.git] / drivers / net / ice / base / ice_common.c
index 786e99d..4b1b310 100644 (file)
@@ -672,6 +672,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
                          "Failed to get scheduler allocated resources\n");
                goto err_unroll_alloc;
        }
+       ice_sched_get_psm_clk_freq(hw);
 
        /* Initialize port_info struct with scheduler data */
        status = ice_sched_init_port(hw->port_info);
@@ -1679,7 +1680,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
        enum ice_status status;
        u16 buf_len;
 
-       buf_len = sizeof(*buf) + sizeof(buf->elem) * (num - 1);
+       buf_len = ice_struct_size(buf, elem, num - 1);
        buf = (struct ice_aqc_alloc_free_res_elem *)
                ice_malloc(hw, buf_len);
        if (!buf)
@@ -1719,7 +1720,7 @@ ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)
        enum ice_status status;
        u16 buf_len;
 
-       buf_len = sizeof(*buf) + sizeof(buf->elem) * (num - 1);
+       buf_len = ice_struct_size(buf, elem, num - 1);
        buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len);
        if (!buf)
                return ICE_ERR_NO_MEMORY;