aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
diff options
context:
space:
mode:
authorLarysa Zaremba <[email protected]>2023-12-05 21:08:32 +0000
committerAlexei Starovoitov <[email protected]>2023-12-14 00:16:40 +0000
commit6b62a42149032db305dfd687d7118aa870b4a2f9 (patch)
treed7340b3f09163f7ac5dcb457e0465e14ff70fbb6 /drivers/net/ethernet/intel/ice/ice_txrx_lib.c
parentice: make RX HW timestamp reading code more reusable (diff)
downloadkernel-6b62a42149032db305dfd687d7118aa870b4a2f9.tar.gz
kernel-6b62a42149032db305dfd687d7118aa870b4a2f9.zip
ice: Make ptype internal to descriptor info processing
Currently, rx_ptype variable is used only as an argument to ice_process_skb_fields() and is computed just before the function call. Therefore, there is no reason to pass this value as an argument. Instead, remove this argument and compute the value directly inside ice_process_skb_fields() function. Also, separate its calculation into a short function, so the code can later be reused in .xmo_() callbacks. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Larysa Zaremba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_txrx_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_txrx_lib.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
index 02d70a96a5a4..8904b22bfba7 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
@@ -203,11 +203,20 @@ ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring,
}
/**
+ * ice_get_ptype - Read HW packet type from the descriptor
+ * @rx_desc: RX descriptor
+ */
+static u16 ice_get_ptype(const union ice_32b_rx_flex_desc *rx_desc)
+{
+ return le16_to_cpu(rx_desc->wb.ptype_flex_flags0) &
+ ICE_RX_FLEX_DESC_PTYPE_M;
+}
+
+/**
* ice_process_skb_fields - Populate skb header fields from Rx descriptor
* @rx_ring: Rx descriptor ring packet is being transacted on
* @rx_desc: pointer to the EOP Rx descriptor
* @skb: pointer to current skb being populated
- * @ptype: the packet type decoded by hardware
*
* This function checks the ring, descriptor, and packet information in
* order to populate the hash, checksum, VLAN, protocol, and
@@ -216,8 +225,10 @@ ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring,
void
ice_process_skb_fields(struct ice_rx_ring *rx_ring,
union ice_32b_rx_flex_desc *rx_desc,
- struct sk_buff *skb, u16 ptype)
+ struct sk_buff *skb)
{
+ u16 ptype = ice_get_ptype(rx_desc);
+
ice_rx_hash_to_skb(rx_ring, rx_desc, skb, ptype);
/* modifies the skb - consumes the enet header */