* [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation
@ 2023-05-12 15:25 Larysa Zaremba
2023-05-12 15:25 ` [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable Larysa Zaremba
` (14 more replies)
0 siblings, 15 replies; 54+ messages in thread
From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw)
To: bpf
Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen,
Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin,
Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev,
intel-wired-lan, linux-kernel
This series introduces XDP hints support into ice driver and adds new kfunc
hints that utilize hardware capabilities.
- patches 01-04 refactors driver descriptor to skb fields processing code,
making it more reusable without changing any behavior.
- patches 05-08 add support add support for existing hints (timestamp and
hash) in ice driver.
- patches 09-12 introduce new kfunc hints, namely 2 VLAN tag hints
(ctag & stag separately) and "checksum level", which is basically
a CHECKSUM_UNNECESSARY indicator. Then those hints are implemented in
ice driver.
- patches 13-15 adjust xdp_hw_metadata to account for new hints.
- in particular, patch 14 lifts the limitation on data_meta size to be
32 or lower, because all the information that needs to be passed into
AF_XDP from XDP in xdp_hw_metadata no longer fits into 32 bytes.
Aleksander Lobakin (1):
net, xdp: allow metadata > 32
Larysa Zaremba (14):
ice: make RX hash reading code more reusable
ice: make RX HW timestamp reading code more reusable
ice: make RX checksum checking code more reusable
ice: Make ptype internal to descriptor info processing
ice: Introduce ice_xdp_buff
ice: Support HW timestamp hint
ice: Support RX hash XDP hint
ice: Support XDP hints in AF_XDP ZC mode
xdp: Add VLAN tag hint
ice: Implement VLAN tag hint
xdp: Add checksum level hint
ice: Implement checksum level hint
selftests/bpf: Allow VLAN packets in xdp_hw_metadata
selftests/bpf: Add flags and new hints to xdp_hw_metadata
Documentation/networking/xdp-rx-metadata.rst | 14 +-
drivers/net/ethernet/intel/ice/ice.h | 2 +
.../net/ethernet/intel/ice/ice_lan_tx_rx.h | 412 +++++++++---------
drivers/net/ethernet/intel/ice/ice_main.c | 1 +
drivers/net/ethernet/intel/ice/ice_ptp.c | 23 +-
drivers/net/ethernet/intel/ice/ice_ptp.h | 18 +-
drivers/net/ethernet/intel/ice/ice_txrx.c | 13 +-
drivers/net/ethernet/intel/ice/ice_txrx.h | 23 +-
drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 311 +++++++++++--
drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 13 +-
drivers/net/ethernet/intel/ice/ice_xsk.c | 16 +-
include/linux/netdevice.h | 3 +
include/linux/skbuff.h | 13 +-
include/net/xdp.h | 16 +-
kernel/bpf/offload.c | 6 +
net/core/xdp.c | 36 ++
.../selftests/bpf/progs/xdp_hw_metadata.c | 49 ++-
tools/testing/selftests/bpf/xdp_hw_metadata.c | 29 +-
tools/testing/selftests/bpf/xdp_metadata.h | 36 +-
19 files changed, 738 insertions(+), 296 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 54+ messages in thread* [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-19 16:46 ` Alexander Lobakin 2023-05-12 15:25 ` [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp " Larysa Zaremba ` (13 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel Previously, we only needed RX hash in skb path, hence all related code was written with skb in mind. But with the addition of XDP hints via kfuncs to the ice driver, the same logic will be needed in .xmo_() callbacks. Separate generic process of reading RX hash from a descriptor into a separate function. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index c8322fb6f2b3..fc67bbf600af 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -63,28 +63,44 @@ static enum pkt_hash_types ice_ptype_to_htype(u16 ptype) } /** - * ice_rx_hash - set the hash value in the skb + * ice_copy_rx_hash_from_desc - copy hash value from descriptor to address + * @rx_desc: specific descriptor + * @dst: address to copy hash value to + * + * Returns true, if valid hash has been copied into the destination address. + */ +static bool +ice_copy_rx_hash_from_desc(union ice_32b_rx_flex_desc *rx_desc, u32 *dst) +{ + struct ice_32b_rx_flex_desc_nic *nic_mdid; + + if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) + return false; + + nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; + *dst = le32_to_cpu(nic_mdid->rss_hash); + return true; +} + +/** + * ice_rx_hash_to_skb - set the hash value in the skb * @rx_ring: descriptor ring * @rx_desc: specific descriptor * @skb: pointer to current skb * @rx_ptype: the ptype value from the descriptor */ static void -ice_rx_hash(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, - struct sk_buff *skb, u16 rx_ptype) +ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, + union ice_32b_rx_flex_desc *rx_desc, + struct sk_buff *skb, u16 rx_ptype) { - struct ice_32b_rx_flex_desc_nic *nic_mdid; u32 hash; if (!(rx_ring->netdev->features & NETIF_F_RXHASH)) return; - if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) - return; - - nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; - hash = le32_to_cpu(nic_mdid->rss_hash); - skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); + if (ice_copy_rx_hash_from_desc(rx_desc, &hash)) + skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); } /** @@ -186,7 +202,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, struct sk_buff *skb, u16 ptype) { - ice_rx_hash(rx_ring, rx_desc, skb, ptype); + ice_rx_hash_to_skb(rx_ring, rx_desc, skb, ptype); /* modifies the skb - consumes the enet header */ skb->protocol = eth_type_trans(skb, rx_ring->netdev); -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable 2023-05-12 15:25 ` [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable Larysa Zaremba @ 2023-05-19 16:46 ` Alexander Lobakin 2023-05-22 15:03 ` Larysa Zaremba 0 siblings, 1 reply; 54+ messages in thread From: Alexander Lobakin @ 2023-05-19 16:46 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Fri, 12 May 2023 17:25:53 +0200 > Previously, we only needed RX hash in skb path, > hence all related code was written with skb in mind. > But with the addition of XDP hints via kfuncs to the ice driver, > the same logic will be needed in .xmo_() callbacks. > > Separate generic process of reading RX hash from a descriptor > into a separate function. > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 38 +++++++++++++------ > 1 file changed, 27 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index c8322fb6f2b3..fc67bbf600af 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -63,28 +63,44 @@ static enum pkt_hash_types ice_ptype_to_htype(u16 ptype) > } > > /** > - * ice_rx_hash - set the hash value in the skb > + * ice_copy_rx_hash_from_desc - copy hash value from descriptor to address > + * @rx_desc: specific descriptor > + * @dst: address to copy hash value to > + * > + * Returns true, if valid hash has been copied into the destination address. > + */ > +static bool > +ice_copy_rx_hash_from_desc(union ice_32b_rx_flex_desc *rx_desc, u32 *dst) @rx_desc can be const. I'm also unsure about the naming. Why not name this one ice_rx_hash() and the one which sets it in skb ice_rx_hash_skb()? > +{ > + struct ice_32b_rx_flex_desc_nic *nic_mdid; Also const. I thought you'll pick most of my optimizations from the related commit :D > + > + if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) > + return false; > + > + nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; > + *dst = le32_to_cpu(nic_mdid->rss_hash); > + return true; You can just return the hash. `hash == 0` means there's no hash, so it basically means `false`, while non-zero is `true`. > +} > + > +/** > + * ice_rx_hash_to_skb - set the hash value in the skb > * @rx_ring: descriptor ring > * @rx_desc: specific descriptor > * @skb: pointer to current skb > * @rx_ptype: the ptype value from the descriptor > */ > static void > -ice_rx_hash(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, > - struct sk_buff *skb, u16 rx_ptype) > +ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, > + union ice_32b_rx_flex_desc *rx_desc, > + struct sk_buff *skb, u16 rx_ptype) > { > - struct ice_32b_rx_flex_desc_nic *nic_mdid; > u32 hash; > > if (!(rx_ring->netdev->features & NETIF_F_RXHASH)) > return; > > - if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) > - return; > - > - nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; > - hash = le32_to_cpu(nic_mdid->rss_hash); > - skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); > + if (ice_copy_rx_hash_from_desc(rx_desc, &hash)) likely()? I wouldn't care about zero-hashed frames, their perf is not critical anyway. > + skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); > } > > /** > @@ -186,7 +202,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > union ice_32b_rx_flex_desc *rx_desc, > struct sk_buff *skb, u16 ptype) > { > - ice_rx_hash(rx_ring, rx_desc, skb, ptype); > + ice_rx_hash_to_skb(rx_ring, rx_desc, skb, ptype); > > /* modifies the skb - consumes the enet header */ > skb->protocol = eth_type_trans(skb, rx_ring->netdev); Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable 2023-05-19 16:46 ` Alexander Lobakin @ 2023-05-22 15:03 ` Larysa Zaremba 2023-05-22 15:36 ` Alexander Lobakin 0 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-22 15:03 UTC (permalink / raw) To: Alexander Lobakin Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On Fri, May 19, 2023 at 06:46:31PM +0200, Alexander Lobakin wrote: > From: Larysa Zaremba <larysa.zaremba@intel.com> > Date: Fri, 12 May 2023 17:25:53 +0200 > > > Previously, we only needed RX hash in skb path, > > hence all related code was written with skb in mind. > > But with the addition of XDP hints via kfuncs to the ice driver, > > the same logic will be needed in .xmo_() callbacks. > > > > Separate generic process of reading RX hash from a descriptor > > into a separate function. > > > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > > --- > > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 38 +++++++++++++------ > > 1 file changed, 27 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > index c8322fb6f2b3..fc67bbf600af 100644 > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > @@ -63,28 +63,44 @@ static enum pkt_hash_types ice_ptype_to_htype(u16 ptype) > > } > > > > /** > > - * ice_rx_hash - set the hash value in the skb > > + * ice_copy_rx_hash_from_desc - copy hash value from descriptor to address > > + * @rx_desc: specific descriptor > > + * @dst: address to copy hash value to > > + * > > + * Returns true, if valid hash has been copied into the destination address. > > + */ > > +static bool > > +ice_copy_rx_hash_from_desc(union ice_32b_rx_flex_desc *rx_desc, u32 *dst) > > @rx_desc can be const. Yes > > I'm also unsure about the naming. Why not name this one ice_rx_hash() > and the one which sets it in skb ice_rx_hash_skb()? I just think that ice_copy_rx_hash_from_desc(desc, &hash, ...); ice_copy_rx_hash_from_desc(desc, hash_ptr, ...); communicates the intention (for a person that does not see a prototype) much better than ice_rx_hash(desc, &hash, ...); ice_rx_hash(desc, hash_ptr, ...); But now when I think about that, 'from_desc' part can probably be dropped without little to no impact, if we also replace 'copy' with sth more descriptive, like: ice_read_rx_hash(desc, &hash, ...); ice_read_rx_hash(desc, hash_ptr, ...); Same for timestamp functions. Probably, the main reason I started naming functions this way was ice_get_vlan_tag_from_rx_desc(). '_from_rx_desc' part is pretty redundant there too. I won't change '_to_skb' part though, I think function should show the direction of change it applies. > > > +{ > > + struct ice_32b_rx_flex_desc_nic *nic_mdid; > > Also const. I thought you'll pick most of my optimizations from the > related commit :D Well, at some point I kinda forgot about the patch, because it wasn't very usefult at the start of development, to be honest. Should have looked at it the the later stages though >_< Will make nic_mdid const. > > > + > > + if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) > > + return false; > > + > > + nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; > > + *dst = le32_to_cpu(nic_mdid->rss_hash); > > + return true; > > You can just return the hash. `hash == 0` means there's no hash, so it > basically means `false`, while non-zero is `true`. Agree about both hash and timestamp. Taking this comment and the earlier on into account, I'll name functions like that: ice_get_rx_hash() ice_get_vlan_tag() ice_ptp_get_rx_hwts_ns() > > > +} > > + > > +/** > > + * ice_rx_hash_to_skb - set the hash value in the skb > > * @rx_ring: descriptor ring > > * @rx_desc: specific descriptor > > * @skb: pointer to current skb > > * @rx_ptype: the ptype value from the descriptor > > */ > > static void > > -ice_rx_hash(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, > > - struct sk_buff *skb, u16 rx_ptype) > > +ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, > > + union ice_32b_rx_flex_desc *rx_desc, > > + struct sk_buff *skb, u16 rx_ptype) > > { > > - struct ice_32b_rx_flex_desc_nic *nic_mdid; > > u32 hash; > > > > if (!(rx_ring->netdev->features & NETIF_F_RXHASH)) > > return; > > > > - if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) > > - return; > > - > > - nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; > > - hash = le32_to_cpu(nic_mdid->rss_hash); > > - skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); > > + if (ice_copy_rx_hash_from_desc(rx_desc, &hash)) > > likely()? I wouldn't care about zero-hashed frames, their perf is not > critical anyway. Sure. > > > + skb_set_hash(skb, hash, ice_ptype_to_htype(rx_ptype)); > > } > > > > /** > > @@ -186,7 +202,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > > union ice_32b_rx_flex_desc *rx_desc, > > struct sk_buff *skb, u16 ptype) > > { > > - ice_rx_hash(rx_ring, rx_desc, skb, ptype); > > + ice_rx_hash_to_skb(rx_ring, rx_desc, skb, ptype); > > > > /* modifies the skb - consumes the enet header */ > > skb->protocol = eth_type_trans(skb, rx_ring->netdev); > > Thanks, > Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable 2023-05-22 15:03 ` Larysa Zaremba @ 2023-05-22 15:36 ` Alexander Lobakin 0 siblings, 0 replies; 54+ messages in thread From: Alexander Lobakin @ 2023-05-22 15:36 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Mon, 22 May 2023 17:03:54 +0200 > On Fri, May 19, 2023 at 06:46:31PM +0200, Alexander Lobakin wrote: >> From: Larysa Zaremba <larysa.zaremba@intel.com> >> Date: Fri, 12 May 2023 17:25:53 +0200 [...] >>> + nic_mdid = (struct ice_32b_rx_flex_desc_nic *)rx_desc; >>> + *dst = le32_to_cpu(nic_mdid->rss_hash); >>> + return true; >> >> You can just return the hash. `hash == 0` means there's no hash, so it >> basically means `false`, while non-zero is `true`. > > Agree about both hash and timestamp. > > Taking this comment and the earlier on into account, I'll name functions like > that: > > ice_get_rx_hash() > ice_get_vlan_tag() > ice_ptp_get_rx_hwts_ns() Sounds good to me! [...] Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp reading code more reusable 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba 2023-05-12 15:25 ` [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-19 16:52 ` Alexander Lobakin 2023-05-12 15:25 ` [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking " Larysa Zaremba ` (12 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel Previously, we only needed RX HW timestamp in skb path, hence all related code was written with skb in mind. But with the addition of XDP hints via kfuncs to the ice driver, the same logic will be needed in .xmo_() callbacks. Put generic process of reading RX HW timestamp from a descriptor into a separate function. Move skb-related code into another source file. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice_ptp.c | 23 +++++++--------- drivers/net/ethernet/intel/ice/ice_ptp.h | 18 ++++++++----- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 27 ++++++++++++++++++- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index ac6f06f9a2ed..c90ce91f11ab 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2142,30 +2142,28 @@ int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr) } /** - * ice_ptp_rx_hwtstamp - Check for an Rx timestamp + * ice_ptp_copy_rx_hwts_from_desc - Check for an Rx timestamp * @rx_ring: Ring to get the VSI info * @rx_desc: Receive descriptor - * @skb: Particular skb to send timestamp with + * @dst: Address to put RX timestamp to * - * The driver receives a notification in the receive descriptor with timestamp. - * The timestamp is in ns, so we must convert the result first. + * If function returns true, dst contains a valid RX timestamp in ns. */ -void -ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, - union ice_32b_rx_flex_desc *rx_desc, struct sk_buff *skb) +bool ice_ptp_copy_rx_hwts_from_desc(struct ice_rx_ring *rx_ring, + union ice_32b_rx_flex_desc *rx_desc, + u64 *dst) { - struct skb_shared_hwtstamps *hwtstamps; u64 ts_ns, cached_time; u32 ts_high; if (!(rx_desc->wb.time_stamp_low & ICE_PTP_TS_VALID)) - return; + return false; cached_time = READ_ONCE(rx_ring->cached_phctime); /* Do not report a timestamp if we don't have a cached PHC time */ if (!cached_time) - return; + return false; /* Use ice_ptp_extend_32b_ts directly, using the ring-specific cached * PHC value, rather than accessing the PF. This also allows us to @@ -2176,9 +2174,8 @@ ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); - hwtstamps = skb_hwtstamps(skb); - memset(hwtstamps, 0, sizeof(*hwtstamps)); - hwtstamps->hwtstamp = ns_to_ktime(ts_ns); + *dst = ts_ns; + return true; } /** diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h index 9cda2f43e0e5..509ea9570276 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp.h @@ -259,9 +259,9 @@ int ice_get_ptp_clock_index(struct ice_pf *pf); s8 ice_ptp_request_ts(struct ice_ptp_tx *tx, struct sk_buff *skb); bool ice_ptp_process_ts(struct ice_pf *pf); -void -ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, - union ice_32b_rx_flex_desc *rx_desc, struct sk_buff *skb); +bool ice_ptp_copy_rx_hwts_from_desc(struct ice_rx_ring *rx_ring, + union ice_32b_rx_flex_desc *rx_desc, + u64 *dst); void ice_ptp_reset(struct ice_pf *pf); void ice_ptp_prepare_for_reset(struct ice_pf *pf); void ice_ptp_init(struct ice_pf *pf); @@ -294,9 +294,15 @@ static inline bool ice_ptp_process_ts(struct ice_pf *pf) { return true; } -static inline void -ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, - union ice_32b_rx_flex_desc *rx_desc, struct sk_buff *skb) { } + +static inline bool +ice_ptp_copy_rx_hwts_from_desc(struct ice_rx_ring *rx_ring, + union ice_32b_rx_flex_desc *rx_desc, + u64 *dst) +{ + return false; +} + static inline void ice_ptp_reset(struct ice_pf *pf) { } static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf) { } static inline void ice_ptp_init(struct ice_pf *pf) { } diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index fc67bbf600af..1aab79dc8915 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -186,6 +186,31 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, ring->vsi->back->hw_csum_rx_error++; } +/** + * ice_ptp_rx_hwts_to_skb - Put RX timestamp into skb, if available + * @rx_ring: Ring to get the VSI info + * @rx_desc: Receive descriptor + * @skb: Particular skb to send timestamp with + * + * The driver receives a notification in the receive descriptor with timestamp. + * The timestamp is in ns, so we must convert the result first. + */ +static void +ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring, + union ice_32b_rx_flex_desc *rx_desc, + struct sk_buff *skb) +{ + struct skb_shared_hwtstamps *hwtstamps; + u64 ts_ns; + + if (!ice_ptp_copy_rx_hwts_from_desc(rx_ring, rx_desc, &ts_ns)) + return; + + hwtstamps = skb_hwtstamps(skb); + memset(hwtstamps, 0, sizeof(*hwtstamps)); + hwtstamps->hwtstamp = ns_to_ktime(ts_ns); +} + /** * ice_process_skb_fields - Populate skb header fields from Rx descriptor * @rx_ring: Rx descriptor ring packet is being transacted on @@ -210,7 +235,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, ice_rx_csum(rx_ring, skb, rx_desc, ptype); if (rx_ring->ptp_rx) - ice_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); + ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); } /** -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp reading code more reusable 2023-05-12 15:25 ` [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp " Larysa Zaremba @ 2023-05-19 16:52 ` Alexander Lobakin 2023-05-22 15:07 ` Larysa Zaremba 0 siblings, 1 reply; 54+ messages in thread From: Alexander Lobakin @ 2023-05-19 16:52 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Fri, 12 May 2023 17:25:54 +0200 > Previously, we only needed RX HW timestamp in skb path, > hence all related code was written with skb in mind. > But with the addition of XDP hints via kfuncs to the ice driver, > the same logic will be needed in .xmo_() callbacks. [...] > @@ -2176,9 +2174,8 @@ ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, > ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); > ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); > > - hwtstamps = skb_hwtstamps(skb); > - memset(hwtstamps, 0, sizeof(*hwtstamps)); > - hwtstamps->hwtstamp = ns_to_ktime(ts_ns); > + *dst = ts_ns; > + return true; Can't we use the same I wrote in the prev. comment, i.e. return 0 or timestamp? I don't think ts == 0 is valid. > } > > /** [...] > + * The driver receives a notification in the receive descriptor with timestamp. > + * The timestamp is in ns, so we must convert the result first. > + */ > +static void > +ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring, > + union ice_32b_rx_flex_desc *rx_desc, > + struct sk_buff *skb) > +{ > + struct skb_shared_hwtstamps *hwtstamps; > + u64 ts_ns; > + > + if (!ice_ptp_copy_rx_hwts_from_desc(rx_ring, rx_desc, &ts_ns)) > + return; > + > + hwtstamps = skb_hwtstamps(skb); > + memset(hwtstamps, 0, sizeof(*hwtstamps)); > + hwtstamps->hwtstamp = ns_to_ktime(ts_ns); Ok, my optimizations aren't in this series :D If you look at the hwtimestamps in skb, you'll see all that can be minimized to just: *skb_hwtstamps(skb) = (struct skb_shared_hwtstamps){ .hwtstamp = ns_to_ktime(ts_ns), }; Compiler will probably do its job, but I wouldn't always rely on it. Sometimes it's even able to not expand memset(8 bytes) to *(u64 *) = 0. > +} > + > /** > * ice_process_skb_fields - Populate skb header fields from Rx descriptor > * @rx_ring: Rx descriptor ring packet is being transacted on > @@ -210,7 +235,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > ice_rx_csum(rx_ring, skb, rx_desc, ptype); > > if (rx_ring->ptp_rx) > - ice_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); > + ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); > } > > /** Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp reading code more reusable 2023-05-19 16:52 ` Alexander Lobakin @ 2023-05-22 15:07 ` Larysa Zaremba 0 siblings, 0 replies; 54+ messages in thread From: Larysa Zaremba @ 2023-05-22 15:07 UTC (permalink / raw) To: Alexander Lobakin Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On Fri, May 19, 2023 at 06:52:13PM +0200, Alexander Lobakin wrote: > From: Larysa Zaremba <larysa.zaremba@intel.com> > Date: Fri, 12 May 2023 17:25:54 +0200 > > > Previously, we only needed RX HW timestamp in skb path, > > hence all related code was written with skb in mind. > > But with the addition of XDP hints via kfuncs to the ice driver, > > the same logic will be needed in .xmo_() callbacks. > > [...] > > > @@ -2176,9 +2174,8 @@ ice_ptp_rx_hwtstamp(struct ice_rx_ring *rx_ring, > > ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); > > ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); > > > > - hwtstamps = skb_hwtstamps(skb); > > - memset(hwtstamps, 0, sizeof(*hwtstamps)); > > - hwtstamps->hwtstamp = ns_to_ktime(ts_ns); > > + *dst = ts_ns; > > + return true; > > Can't we use the same I wrote in the prev. comment, i.e. return 0 or > timestamp? I don't think ts == 0 is valid. > Agreed with this in the answer to the previous email :) > > } > > > > /** > > [...] > > > + * The driver receives a notification in the receive descriptor with timestamp. > > + * The timestamp is in ns, so we must convert the result first. > > + */ > > +static void > > +ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring, > > + union ice_32b_rx_flex_desc *rx_desc, > > + struct sk_buff *skb) > > +{ > > + struct skb_shared_hwtstamps *hwtstamps; > > + u64 ts_ns; > > + > > + if (!ice_ptp_copy_rx_hwts_from_desc(rx_ring, rx_desc, &ts_ns)) > > + return; > > + > > + hwtstamps = skb_hwtstamps(skb); > > + memset(hwtstamps, 0, sizeof(*hwtstamps)); > > + hwtstamps->hwtstamp = ns_to_ktime(ts_ns); > > Ok, my optimizations aren't in this series :D > If you look at the hwtimestamps in skb, you'll see all that can be > minimized to just: > > *skb_hwtstamps(skb) = (struct skb_shared_hwtstamps){ > .hwtstamp = ns_to_ktime(ts_ns), > }; > > Compiler will probably do its job, but I wouldn't always rely on it. > Sometimes it's even able to not expand memset(8 bytes) to *(u64 *) = 0. Ok, will fix. > > > +} > > + > > /** > > * ice_process_skb_fields - Populate skb header fields from Rx descriptor > > * @rx_ring: Rx descriptor ring packet is being transacted on > > @@ -210,7 +235,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > > ice_rx_csum(rx_ring, skb, rx_desc, ptype); > > > > if (rx_ring->ptp_rx) > > - ice_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); > > + ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); > > } > > > > /** > > Thanks, > Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking code more reusable 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba 2023-05-12 15:25 ` [PATCH RESEND bpf-next 01/15] ice: make RX hash reading code more reusable Larysa Zaremba 2023-05-12 15:25 ` [PATCH RESEND bpf-next 02/15] ice: make RX HW timestamp " Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-22 15:51 ` Alexander Lobakin 2023-05-12 15:25 ` [PATCH RESEND bpf-next 04/15] ice: Make ptype internal to descriptor info processing Larysa Zaremba ` (11 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel Previously, we only needed RX checksum flags in skb path, hence all related code was written with skb in mind. But with the addition of XDP hints via kfuncs to the ice driver, the same logic will be needed in .xmo_() callbacks. Put generic process of determining checksum status into a separate function. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 71 ++++++++++++------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 1aab79dc8915..6a4fd3f3fc0a 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -104,17 +104,17 @@ ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, } /** - * ice_rx_csum - Indicate in skb if checksum is good - * @ring: the ring we care about - * @skb: skb currently being received and modified + * ice_rx_csum_checked - Indicates, whether hardware has checked the checksum * @rx_desc: the receive descriptor * @ptype: the packet type decoded by hardware + * @csum_lvl_dst: address to put checksum level into + * @ring: ring for error stats, can be NULL * - * skb->protocol must be set before this function is called + * Returns true, if hardware has checked the checksum. */ -static void -ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, - union ice_32b_rx_flex_desc *rx_desc, u16 ptype) +static bool +ice_rx_csum_checked(union ice_32b_rx_flex_desc *rx_desc, u16 ptype, + u8 *csum_lvl_dst, struct ice_rx_ring *ring) { struct ice_rx_ptype_decoded decoded; u16 rx_status0, rx_status1; @@ -125,20 +125,12 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, decoded = ice_decode_rx_desc_ptype(ptype); - /* Start with CHECKSUM_NONE and by default csum_level = 0 */ - skb->ip_summed = CHECKSUM_NONE; - skb_checksum_none_assert(skb); - - /* check if Rx checksum is enabled */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) - return; - /* check if HW has decoded the packet and checksum */ if (!(rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_L3L4P_S))) - return; + return false; if (!(decoded.known && decoded.outer_ip)) - return; + return false; ipv4 = (decoded.outer_ip == ICE_RX_PTYPE_OUTER_IP) && (decoded.outer_ip_ver == ICE_RX_PTYPE_OUTER_IPV4); @@ -168,22 +160,51 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, * we are indicating we validated the inner checksum. */ if (decoded.tunnel_type >= ICE_RX_PTYPE_TUNNEL_IP_GRENAT) - skb->csum_level = 1; + *csum_lvl_dst = 1; /* Only report checksum unnecessary for TCP, UDP, or SCTP */ switch (decoded.inner_prot) { case ICE_RX_PTYPE_INNER_PROT_TCP: case ICE_RX_PTYPE_INNER_PROT_UDP: case ICE_RX_PTYPE_INNER_PROT_SCTP: - skb->ip_summed = CHECKSUM_UNNECESSARY; - break; - default: - break; + return true; } - return; + + return false; checksum_fail: - ring->vsi->back->hw_csum_rx_error++; + if (ring) + ring->vsi->back->hw_csum_rx_error++; + + return false; +} + +/** + * ice_rx_csum_into_skb - Indicate in skb if checksum is good + * @ring: the ring we care about + * @skb: skb currently being received and modified + * @rx_desc: the receive descriptor + * @ptype: the packet type decoded by hardware + */ +static void +ice_rx_csum_into_skb(struct ice_rx_ring *ring, struct sk_buff *skb, + union ice_32b_rx_flex_desc *rx_desc, u16 ptype) +{ + u8 csum_level = 0; + + /* Start with CHECKSUM_NONE and by default csum_level = 0 */ + skb->ip_summed = CHECKSUM_NONE; + skb_checksum_none_assert(skb); + + /* check if Rx checksum is enabled */ + if (!(ring->netdev->features & NETIF_F_RXCSUM)) + return; + + if (!ice_rx_csum_checked(rx_desc, ptype, &csum_level, ring)) + return; + + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->csum_level = csum_level; } /** @@ -232,7 +253,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, /* modifies the skb - consumes the enet header */ skb->protocol = eth_type_trans(skb, rx_ring->netdev); - ice_rx_csum(rx_ring, skb, rx_desc, ptype); + ice_rx_csum_into_skb(rx_ring, skb, rx_desc, ptype); if (rx_ring->ptp_rx) ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking code more reusable 2023-05-12 15:25 ` [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking " Larysa Zaremba @ 2023-05-22 15:51 ` Alexander Lobakin 2023-05-22 16:05 ` Larysa Zaremba 0 siblings, 1 reply; 54+ messages in thread From: Alexander Lobakin @ 2023-05-22 15:51 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Fri, 12 May 2023 17:25:55 +0200 > Previously, we only needed RX checksum flags in skb path, > hence all related code was written with skb in mind. > But with the addition of XDP hints via kfuncs to the ice driver, > the same logic will be needed in .xmo_() callbacks. > > Put generic process of determining checksum status into > a separate function. > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 71 ++++++++++++------- > 1 file changed, 46 insertions(+), 25 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index 1aab79dc8915..6a4fd3f3fc0a 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -104,17 +104,17 @@ ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, > } > > /** > - * ice_rx_csum - Indicate in skb if checksum is good > - * @ring: the ring we care about > - * @skb: skb currently being received and modified > + * ice_rx_csum_checked - Indicates, whether hardware has checked the checksum %CHECKSUM_UNNECESSARY means that the csum is correct / frame is not damaged. So "checked" is not enough I'd say, it's "verified" at least. OTOH that's too long already, I'd go with classic "csum_ok" :D > * @rx_desc: the receive descriptor > * @ptype: the packet type decoded by hardware > + * @csum_lvl_dst: address to put checksum level into > + * @ring: ring for error stats, can be NULL > * > - * skb->protocol must be set before this function is called > + * Returns true, if hardware has checked the checksum. > */ > -static void > -ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, > - union ice_32b_rx_flex_desc *rx_desc, u16 ptype) > +static bool > +ice_rx_csum_checked(union ice_32b_rx_flex_desc *rx_desc, u16 ptype, (also const, but I guess you'll do that either way after the previous mails) > + u8 *csum_lvl_dst, struct ice_rx_ring *ring) > { > struct ice_rx_ptype_decoded decoded; > u16 rx_status0, rx_status1; [...] > +/** > + * ice_rx_csum_into_skb - Indicate in skb if checksum is good > + * @ring: the ring we care about > + * @skb: skb currently being received and modified > + * @rx_desc: the receive descriptor > + * @ptype: the packet type decoded by hardware > + */ > +static void > +ice_rx_csum_into_skb(struct ice_rx_ring *ring, struct sk_buff *skb, > + union ice_32b_rx_flex_desc *rx_desc, u16 ptype) > +{ > + u8 csum_level = 0; I'm not a fan of variables shorter than u32 on the stack. And since it gets passed by a reference, I'm not sure the compiler will inline it =\ > + > + /* Start with CHECKSUM_NONE and by default csum_level = 0 */ > + skb->ip_summed = CHECKSUM_NONE; > + skb_checksum_none_assert(skb); Can we also remove this? Neither of these makes sense. ::ip_summed is always zeroed after the memset() in __build_skb_around() (somewhere there), while the assertion checks for `skb->ip_summed == CHECKSUM_NONE`, i.e. it's *always* true here (set and check :D). It's some ancient pathetic rituals copied over and over again from e100 centuries or so... ...and BTW the comment is misleading, because the code doesn't zero ::csum_level as they claim :D > + > + /* check if Rx checksum is enabled */ > + if (!(ring->netdev->features & NETIF_F_RXCSUM)) > + return; > + > + if (!ice_rx_csum_checked(rx_desc, ptype, &csum_level, ring)) > + return; > + > + skb->ip_summed = CHECKSUM_UNNECESSARY; > + skb->csum_level = csum_level; Since csum_level is useless when ip_summed is set to NONE, what do you think about making the function return -1, 0, or 1 without writing anything by reference? int csum_level; csum_level = ice_rx_csum_ok(rx_desc, ptype, ring); if (csum_level < 0) return; skb->ip_summed = CHECKSUM_UNNECESSARY; skb->csum_level = csum_level; I'm not saying it's better (might be a bit at codegen), just proposing. > } > > /** > @@ -232,7 +253,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > /* modifies the skb - consumes the enet header */ > skb->protocol = eth_type_trans(skb, rx_ring->netdev); > > - ice_rx_csum(rx_ring, skb, rx_desc, ptype); > + ice_rx_csum_into_skb(rx_ring, skb, rx_desc, ptype); > > if (rx_ring->ptp_rx) > ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking code more reusable 2023-05-22 15:51 ` Alexander Lobakin @ 2023-05-22 16:05 ` Larysa Zaremba 0 siblings, 0 replies; 54+ messages in thread From: Larysa Zaremba @ 2023-05-22 16:05 UTC (permalink / raw) To: Alexander Lobakin Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On Mon, May 22, 2023 at 05:51:37PM +0200, Alexander Lobakin wrote: > From: Larysa Zaremba <larysa.zaremba@intel.com> > Date: Fri, 12 May 2023 17:25:55 +0200 > > > Previously, we only needed RX checksum flags in skb path, > > hence all related code was written with skb in mind. > > But with the addition of XDP hints via kfuncs to the ice driver, > > the same logic will be needed in .xmo_() callbacks. > > > > Put generic process of determining checksum status into > > a separate function. > > > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > > --- > > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 71 ++++++++++++------- > > 1 file changed, 46 insertions(+), 25 deletions(-) > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > index 1aab79dc8915..6a4fd3f3fc0a 100644 > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > > @@ -104,17 +104,17 @@ ice_rx_hash_to_skb(struct ice_rx_ring *rx_ring, > > } > > > > /** > > - * ice_rx_csum - Indicate in skb if checksum is good > > - * @ring: the ring we care about > > - * @skb: skb currently being received and modified > > + * ice_rx_csum_checked - Indicates, whether hardware has checked the checksum > > %CHECKSUM_UNNECESSARY means that the csum is correct / frame is not > damaged. So "checked" is not enough I'd say, it's "verified" at least. > OTOH that's too long already, I'd go with classic "csum_ok" :D 'csum_ok' sounds good :) 'csum_valid' if want to be fancy > > > * @rx_desc: the receive descriptor > > * @ptype: the packet type decoded by hardware > > + * @csum_lvl_dst: address to put checksum level into > > + * @ring: ring for error stats, can be NULL > > * > > - * skb->protocol must be set before this function is called > > + * Returns true, if hardware has checked the checksum. > > */ > > -static void > > -ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb, > > - union ice_32b_rx_flex_desc *rx_desc, u16 ptype) > > +static bool > > +ice_rx_csum_checked(union ice_32b_rx_flex_desc *rx_desc, u16 ptype, > > (also const, but I guess you'll do that either way after the previous > mails) OK > > > + u8 *csum_lvl_dst, struct ice_rx_ring *ring) > > { > > struct ice_rx_ptype_decoded decoded; > > u16 rx_status0, rx_status1; > > [...] > > > +/** > > + * ice_rx_csum_into_skb - Indicate in skb if checksum is good > > + * @ring: the ring we care about > > + * @skb: skb currently being received and modified > > + * @rx_desc: the receive descriptor > > + * @ptype: the packet type decoded by hardware > > + */ > > +static void > > +ice_rx_csum_into_skb(struct ice_rx_ring *ring, struct sk_buff *skb, > > + union ice_32b_rx_flex_desc *rx_desc, u16 ptype) > > +{ > > + u8 csum_level = 0; > > I'm not a fan of variables shorter than u32 on the stack. And since it > gets passed by a reference, I'm not sure the compiler will inline it =\ > > > + > > + /* Start with CHECKSUM_NONE and by default csum_level = 0 */ > > + skb->ip_summed = CHECKSUM_NONE; > > + skb_checksum_none_assert(skb); > > Can we also remove this? Neither of these makes sense. ::ip_summed is > always zeroed after the memset() in __build_skb_around() (somewhere > there), while the assertion checks for `skb->ip_summed == > CHECKSUM_NONE`, i.e. it's *always* true here (set and check :D). It's > some ancient pathetic rituals copied over and over again from e100 > centuries or so... Will fix. > > ...and BTW the comment is misleading, because the code doesn't zero > ::csum_level as they claim :D > > > + > > + /* check if Rx checksum is enabled */ > > + if (!(ring->netdev->features & NETIF_F_RXCSUM)) > > + return; > > + > > + if (!ice_rx_csum_checked(rx_desc, ptype, &csum_level, ring)) > > + return; > > + > > + skb->ip_summed = CHECKSUM_UNNECESSARY; > > + skb->csum_level = csum_level; > > Since csum_level is useless when ip_summed is set to NONE, what do you > think about making the function return -1, 0, or 1 without writing > anything by reference? > > int csum_level; > > csum_level = ice_rx_csum_ok(rx_desc, ptype, ring); > if (csum_level < 0) > return; > > skb->ip_summed = CHECKSUM_UNNECESSARY; > skb->csum_level = csum_level; > > I'm not saying it's better (might be a bit at codegen), just proposing. I think it's worth a try. > > > } > > > > /** > > @@ -232,7 +253,7 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > > /* modifies the skb - consumes the enet header */ > > skb->protocol = eth_type_trans(skb, rx_ring->netdev); > > > > - ice_rx_csum(rx_ring, skb, rx_desc, ptype); > > + ice_rx_csum_into_skb(rx_ring, skb, rx_desc, ptype); > > > > if (rx_ring->ptp_rx) > > ice_ptp_rx_hwts_to_skb(rx_ring, rx_desc, skb); > > Thanks, > Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 04/15] ice: Make ptype internal to descriptor info processing 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba ` (2 preceding siblings ...) 2023-05-12 15:25 ` [PATCH RESEND bpf-next 03/15] ice: make RX checksum checking " Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-12 15:25 ` [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff Larysa Zaremba ` (10 subsequent siblings) 14 siblings, 0 replies; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel 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. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice_txrx.c | 6 +----- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 15 +++++++++++++-- drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 2 +- drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 4fcf2d07eb85..c9bb77da0861 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -1181,7 +1181,6 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) unsigned int size; u16 stat_err_bits; u16 vlan_tag = 0; - u16 rx_ptype; /* get the Rx desc from Rx ring based on 'next_to_clean' */ rx_desc = ICE_RX_DESC(rx_ring, ntc); @@ -1286,10 +1285,7 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) total_rx_bytes += skb->len; /* populate checksum, VLAN, and protocol */ - rx_ptype = le16_to_cpu(rx_desc->wb.ptype_flex_flags0) & - ICE_RX_FLEX_DESC_PTYPE_M; - - ice_process_skb_fields(rx_ring, rx_desc, skb, rx_ptype); + ice_process_skb_fields(rx_ring, rx_desc, skb); ice_trace(clean_rx_irq_indicate, rx_ring, rx_desc, skb); /* send completed skb up the stack */ diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 6a4fd3f3fc0a..2515f5f7a2b6 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -232,12 +232,21 @@ ice_ptp_rx_hwts_to_skb(struct ice_rx_ring *rx_ring, hwtstamps->hwtstamp = ns_to_ktime(ts_ns); } +/** + * ice_get_ptype - Read HW packet type from the descriptor + * @rx_desc: RX descriptor + */ +static u16 ice_get_ptype(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 @@ -246,8 +255,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 */ diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h index 115969ecdf7b..e1d49e1235b3 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h @@ -148,7 +148,7 @@ void ice_release_rx_desc(struct ice_rx_ring *rx_ring, u16 val); 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); void ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag); #endif /* !_ICE_TXRX_LIB_H_ */ diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index d1e489da7363..3b80aed5d47a 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -857,7 +857,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget) rx_ptype = le16_to_cpu(rx_desc->wb.ptype_flex_flags0) & ICE_RX_FLEX_DESC_PTYPE_M; - ice_process_skb_fields(rx_ring, rx_desc, skb, rx_ptype); + ice_process_skb_fields(rx_ring, rx_desc, skb); ice_receive_skb(rx_ring, skb, vlan_tag); } -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba ` (3 preceding siblings ...) 2023-05-12 15:25 ` [PATCH RESEND bpf-next 04/15] ice: Make ptype internal to descriptor info processing Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-22 16:46 ` Alexander Lobakin 2023-05-12 15:25 ` [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint Larysa Zaremba ` (9 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel In order to use XDP hints via kfuncs we need to put RX descriptor and ring pointers just next to xdp_buff. Same as in hints implementations in other drivers, we archieve this through putting xdp_buff into a child structure. Currently, xdp_buff is stored in the ring structure, so replace it with union that includes child structure. This way enough memory is available while existing XDP code remains isolated from hints. Size of the new child structure (ice_xdp_buff) is 72 bytes, therefore it does not fit into a single cache line. To at least place union at the start of cache line, move 'next' field from CL3 to CL1, as it isn't used often. Placing union at the start of cache line makes at least xdp_buff and descriptor fit into a single CL, ring pointer is used less often, so it can spill into the next CL. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice_txrx.c | 7 ++++-- drivers/net/ethernet/intel/ice/ice_txrx.h | 23 ++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 11 +++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index c9bb77da0861..ca21a71749b6 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -557,13 +557,14 @@ ice_rx_frame_truesize(struct ice_rx_ring *rx_ring, const unsigned int size) * @xdp_prog: XDP program to run * @xdp_ring: ring to be used for XDP_TX action * @rx_buf: Rx buffer to store the XDP action + * @eop_desc: Last descriptor in packet to read metadata from * * Returns any of ICE_XDP_{PASS, CONSUMED, TX, REDIR} */ static void ice_run_xdp(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring, - struct ice_rx_buf *rx_buf) + struct ice_rx_buf *rx_buf, union ice_32b_rx_flex_desc *eop_desc) { unsigned int ret = ICE_XDP_PASS; u32 act; @@ -571,6 +572,8 @@ ice_run_xdp(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, if (!xdp_prog) goto exit; + ice_xdp_set_meta_srcs(xdp, eop_desc, rx_ring); + act = bpf_prog_run_xdp(xdp_prog, xdp); switch (act) { case XDP_PASS: @@ -1240,7 +1243,7 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) if (ice_is_non_eop(rx_ring, rx_desc)) continue; - ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_buf); + ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_buf, rx_desc); if (rx_buf->act == ICE_XDP_PASS) goto construct_skb; total_rx_bytes += xdp_get_buff_len(xdp); diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h index fff0efe28373..f1ac2eb974f1 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.h +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h @@ -260,6 +260,15 @@ enum ice_rx_dtype { ICE_RX_DTYPE_SPLIT_ALWAYS = 2, }; +struct ice_xdp_buff { + struct xdp_buff xdp_buff; + union ice_32b_rx_flex_desc *eop_desc; /* Required for all metadata */ + /* End of the 1st cache line */ + struct ice_rx_ring *rx_ring; +}; + +static_assert(offsetof(struct ice_xdp_buff, xdp_buff) == 0); + /* indices into GLINT_ITR registers */ #define ICE_RX_ITR ICE_IDX_ITR0 #define ICE_TX_ITR ICE_IDX_ITR1 @@ -301,7 +310,6 @@ enum ice_dynamic_itr { /* descriptor ring, associated with a VSI */ struct ice_rx_ring { /* CL1 - 1st cacheline starts here */ - struct ice_rx_ring *next; /* pointer to next ring in q_vector */ void *desc; /* Descriptor ring memory */ struct device *dev; /* Used for DMA mapping */ struct net_device *netdev; /* netdev ring maps to */ @@ -313,12 +321,19 @@ struct ice_rx_ring { u16 count; /* Number of descriptors */ u16 reg_idx; /* HW register index of the ring */ u16 next_to_alloc; - /* CL2 - 2nd cacheline starts here */ + union { struct ice_rx_buf *rx_buf; struct xdp_buff **xdp_buf; }; - struct xdp_buff xdp; + /* CL2 - 2nd cacheline starts here + * Size of ice_xdp_buff is 72 bytes, + * so it spills into CL3 + */ + union { + struct ice_xdp_buff xdp_ext; + struct xdp_buff xdp; + }; /* CL3 - 3rd cacheline starts here */ struct bpf_prog *xdp_prog; u16 rx_offset; @@ -328,6 +343,8 @@ struct ice_rx_ring { u16 next_to_clean; u16 first_desc; + struct ice_rx_ring *next; /* pointer to next ring in q_vector */ + /* stats structs */ struct ice_ring_stats *ring_stats; diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h index e1d49e1235b3..2835a8348237 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h @@ -151,4 +151,15 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, struct sk_buff *skb); void ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag); + +static inline void +ice_xdp_set_meta_srcs(struct xdp_buff *xdp, + union ice_32b_rx_flex_desc *eop_desc, + struct ice_rx_ring *rx_ring) +{ + struct ice_xdp_buff *xdp_ext = (struct ice_xdp_buff *)xdp; + + xdp_ext->eop_desc = eop_desc; + xdp_ext->rx_ring = rx_ring; +} #endif /* !_ICE_TXRX_LIB_H_ */ -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff 2023-05-12 15:25 ` [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff Larysa Zaremba @ 2023-05-22 16:46 ` Alexander Lobakin 2023-05-23 8:02 ` Larysa Zaremba 0 siblings, 1 reply; 54+ messages in thread From: Alexander Lobakin @ 2023-05-22 16:46 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Fri, 12 May 2023 17:25:57 +0200 > In order to use XDP hints via kfuncs we need to put > RX descriptor and ring pointers just next to xdp_buff. > Same as in hints implementations in other drivers, we archieve > this through putting xdp_buff into a child structure. > > Currently, xdp_buff is stored in the ring structure, > so replace it with union that includes child structure. > This way enough memory is available while existing XDP code > remains isolated from hints. > > Size of the new child structure (ice_xdp_buff) is 72 bytes, > therefore it does not fit into a single cache line. > To at least place union at the start of cache line, move 'next' > field from CL3 to CL1, as it isn't used often. > > Placing union at the start of cache line makes at least xdp_buff > and descriptor fit into a single CL, > ring pointer is used less often, so it can spill into the next CL. Spill or span? > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > drivers/net/ethernet/intel/ice/ice_txrx.c | 7 ++++-- > drivers/net/ethernet/intel/ice/ice_txrx.h | 23 ++++++++++++++++--- > drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 11 +++++++++ > 3 files changed, 36 insertions(+), 5 deletions(-) [...] > --- a/drivers/net/ethernet/intel/ice/ice_txrx.h > +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h > @@ -260,6 +260,15 @@ enum ice_rx_dtype { > ICE_RX_DTYPE_SPLIT_ALWAYS = 2, > }; > > +struct ice_xdp_buff { > + struct xdp_buff xdp_buff; > + union ice_32b_rx_flex_desc *eop_desc; /* Required for all metadata */ Probably can be const here as well after changing all the places appropriately -- I don't think you write to it anywhere. > + /* End of the 1st cache line */ > + struct ice_rx_ring *rx_ring; Can't we get rid of ring dependency? Maybe there's only a couple fields that could be copied here instead of referencing the ring? I just find it weird that our drivers often look for something in the ring structure to parse a descriptor ._. If not, can't it be const? > +}; > + > +static_assert(offsetof(struct ice_xdp_buff, xdp_buff) == 0); > + > /* indices into GLINT_ITR registers */ > #define ICE_RX_ITR ICE_IDX_ITR0 > #define ICE_TX_ITR ICE_IDX_ITR1 > @@ -301,7 +310,6 @@ enum ice_dynamic_itr { > /* descriptor ring, associated with a VSI */ > struct ice_rx_ring { > /* CL1 - 1st cacheline starts here */ > - struct ice_rx_ring *next; /* pointer to next ring in q_vector */ > void *desc; /* Descriptor ring memory */ > struct device *dev; /* Used for DMA mapping */ > struct net_device *netdev; /* netdev ring maps to */ > @@ -313,12 +321,19 @@ struct ice_rx_ring { > u16 count; /* Number of descriptors */ > u16 reg_idx; /* HW register index of the ring */ > u16 next_to_alloc; > - /* CL2 - 2nd cacheline starts here */ > + > union { > struct ice_rx_buf *rx_buf; > struct xdp_buff **xdp_buf; > }; > - struct xdp_buff xdp; > + /* CL2 - 2nd cacheline starts here > + * Size of ice_xdp_buff is 72 bytes, > + * so it spills into CL3 > + */ > + union { > + struct ice_xdp_buff xdp_ext; > + struct xdp_buff xdp; > + }; ...or you can leave just one xdp_ext (naming it just "xdp") -- for now, this union does literally nothing, as xdp_ext contains xdp at its very beginning. > /* CL3 - 3rd cacheline starts here */ > struct bpf_prog *xdp_prog; > u16 rx_offset; > @@ -328,6 +343,8 @@ struct ice_rx_ring { > u16 next_to_clean; > u16 first_desc; > > + struct ice_rx_ring *next; /* pointer to next ring in q_vector */ It can be placed even farther, somewhere near rcu_head -- IIRC it's not used anywhere on hotpath. Even ::ring_stats below is hotter. > + > /* stats structs */ > struct ice_ring_stats *ring_stats; > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > index e1d49e1235b3..2835a8348237 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > @@ -151,4 +151,15 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > struct sk_buff *skb); > void > ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag); > + > +static inline void > +ice_xdp_set_meta_srcs(struct xdp_buff *xdp, Not sure about the naming... But can't propose anything :clownface: ice_xdp_init_buff()? Like xdp_init_buff(), but ice_xdp_buff :D > + union ice_32b_rx_flex_desc *eop_desc, > + struct ice_rx_ring *rx_ring) > +{ > + struct ice_xdp_buff *xdp_ext = (struct ice_xdp_buff *)xdp; I'd use container_of(), even though it will do the same thing here. BTW, is having &xdp_buff at offset 0 still a requirement? > + > + xdp_ext->eop_desc = eop_desc; > + xdp_ext->rx_ring = rx_ring; > +} > #endif /* !_ICE_TXRX_LIB_H_ */ Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff 2023-05-22 16:46 ` Alexander Lobakin @ 2023-05-23 8:02 ` Larysa Zaremba 2023-05-25 11:02 ` Alexander Lobakin 0 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-23 8:02 UTC (permalink / raw) To: Alexander Lobakin Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On Mon, May 22, 2023 at 06:46:40PM +0200, Alexander Lobakin wrote: > From: Larysa Zaremba <larysa.zaremba@intel.com> > Date: Fri, 12 May 2023 17:25:57 +0200 > > > In order to use XDP hints via kfuncs we need to put > > RX descriptor and ring pointers just next to xdp_buff. > > Same as in hints implementations in other drivers, we archieve > > this through putting xdp_buff into a child structure. > > > > Currently, xdp_buff is stored in the ring structure, > > so replace it with union that includes child structure. > > This way enough memory is available while existing XDP code > > remains isolated from hints. > > > > Size of the new child structure (ice_xdp_buff) is 72 bytes, > > therefore it does not fit into a single cache line. > > To at least place union at the start of cache line, move 'next' > > field from CL3 to CL1, as it isn't used often. > > > > Placing union at the start of cache line makes at least xdp_buff > > and descriptor fit into a single CL, > > ring pointer is used less often, so it can spill into the next CL. > > Spill or span? I guess 'span' is the better word. > > > > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > > --- > > drivers/net/ethernet/intel/ice/ice_txrx.c | 7 ++++-- > > drivers/net/ethernet/intel/ice/ice_txrx.h | 23 ++++++++++++++++--- > > drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 11 +++++++++ > > 3 files changed, 36 insertions(+), 5 deletions(-) > > [...] > > > --- a/drivers/net/ethernet/intel/ice/ice_txrx.h > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h > > @@ -260,6 +260,15 @@ enum ice_rx_dtype { > > ICE_RX_DTYPE_SPLIT_ALWAYS = 2, > > }; > > > > +struct ice_xdp_buff { > > + struct xdp_buff xdp_buff; > > + union ice_32b_rx_flex_desc *eop_desc; /* Required for all metadata */ > > Probably can be const here as well after changing all the places > appropriately -- I don't think you write to it anywhere. Correct. > > > + /* End of the 1st cache line */ > > + struct ice_rx_ring *rx_ring; > > Can't we get rid of ring dependency? Maybe there's only a couple fields > that could be copied here instead of referencing the ring? I just find > it weird that our drivers often look for something in the ring structure > to parse a descriptor ._. > If not, can't it be const? You're right, I could put just rx_ring->cached_phctime into this structure. But I recall you saying that if we access ring for timestamps only this is not a problem :) > > > +}; > > + > > +static_assert(offsetof(struct ice_xdp_buff, xdp_buff) == 0); > > + > > /* indices into GLINT_ITR registers */ > > #define ICE_RX_ITR ICE_IDX_ITR0 > > #define ICE_TX_ITR ICE_IDX_ITR1 > > @@ -301,7 +310,6 @@ enum ice_dynamic_itr { > > /* descriptor ring, associated with a VSI */ > > struct ice_rx_ring { > > /* CL1 - 1st cacheline starts here */ > > - struct ice_rx_ring *next; /* pointer to next ring in q_vector */ > > void *desc; /* Descriptor ring memory */ > > struct device *dev; /* Used for DMA mapping */ > > struct net_device *netdev; /* netdev ring maps to */ > > @@ -313,12 +321,19 @@ struct ice_rx_ring { > > u16 count; /* Number of descriptors */ > > u16 reg_idx; /* HW register index of the ring */ > > u16 next_to_alloc; > > - /* CL2 - 2nd cacheline starts here */ > > + > > union { > > struct ice_rx_buf *rx_buf; > > struct xdp_buff **xdp_buf; > > }; > > - struct xdp_buff xdp; > > + /* CL2 - 2nd cacheline starts here > > + * Size of ice_xdp_buff is 72 bytes, > > + * so it spills into CL3 > > + */ > > + union { > > + struct ice_xdp_buff xdp_ext; > > + struct xdp_buff xdp; > > + }; > > ...or you can leave just one xdp_ext (naming it just "xdp") -- for now, > this union does literally nothing, as xdp_ext contains xdp at its very > beginning. I would like to leave non-meta-related-code rather unaware of existance of ice_xdp_buff. Why access '&ring->xdp.xdp_buff' or '(struct xdp_buff *)xdp', when we can do just 'ring->xdp'? > > > /* CL3 - 3rd cacheline starts here */ > > struct bpf_prog *xdp_prog; > > u16 rx_offset; > > @@ -328,6 +343,8 @@ struct ice_rx_ring { > > u16 next_to_clean; > > u16 first_desc; > > > > + struct ice_rx_ring *next; /* pointer to next ring in q_vector */ > > It can be placed even farther, somewhere near rcu_head -- IIRC it's not > used anywhere on hotpath. Even ::ring_stats below is hotter. Ok, I'll try to but it further from the start. > > > + > > /* stats structs */ > > struct ice_ring_stats *ring_stats; > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > > index e1d49e1235b3..2835a8348237 100644 > > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h > > @@ -151,4 +151,15 @@ ice_process_skb_fields(struct ice_rx_ring *rx_ring, > > struct sk_buff *skb); > > void > > ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag); > > + > > +static inline void > > +ice_xdp_set_meta_srcs(struct xdp_buff *xdp, > > Not sure about the naming... But can't propose anything :clownface: > ice_xdp_init_buff()? Like xdp_init_buff(), but ice_xdp_buff :D ice_xdp_init_buff() sound exactly like a custom wrapper for xdp_init_buff(), but usage of those functions would be quite different. I've contemplated the naming of this one for some time and think it's good enough as it is, at least it communicates that function has sth to do with 'xdp' and 'meta' and doesn't sound like it fills in metadata. > > > + union ice_32b_rx_flex_desc *eop_desc, > > + struct ice_rx_ring *rx_ring) > > +{ > > + struct ice_xdp_buff *xdp_ext = (struct ice_xdp_buff *)xdp; > > I'd use container_of(), even though it will do the same thing here. > BTW, is having &xdp_buff at offset 0 still a requirement? I've actually forgot about why it is a requirement, but have found my older github answer to you. "AF_XDP implementation also assumes xdp_buff is at the start". What I meant by that is xdp_buffs from xsk_pool have only tailroom. Maybe I should add a comment about this next to static assert. Will change to container_of, I guess it's more future-proof. > > > + > > + xdp_ext->eop_desc = eop_desc; > > + xdp_ext->rx_ring = rx_ring; > > +} > > #endif /* !_ICE_TXRX_LIB_H_ */ > > Thanks, > Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff 2023-05-23 8:02 ` Larysa Zaremba @ 2023-05-25 11:02 ` Alexander Lobakin 0 siblings, 0 replies; 54+ messages in thread From: Alexander Lobakin @ 2023-05-25 11:02 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel From: Larysa Zaremba <larysa.zaremba@intel.com> Date: Tue, 23 May 2023 10:02:42 +0200 > On Mon, May 22, 2023 at 06:46:40PM +0200, Alexander Lobakin wrote: >> From: Larysa Zaremba <larysa.zaremba@intel.com> >> Date: Fri, 12 May 2023 17:25:57 +0200 >> >>> In order to use XDP hints via kfuncs we need to put >>> RX descriptor and ring pointers just next to xdp_buff. >>> Same as in hints implementations in other drivers, we archieve ^^^^^^^^ achieve I missed this one initially :D >>> this through putting xdp_buff into a child structure. >>> >>> Currently, xdp_buff is stored in the ring structure, >>> so replace it with union that includes child structure. >>> This way enough memory is available while existing XDP code >>> remains isolated from hints. [...] >>> + /* End of the 1st cache line */ >>> + struct ice_rx_ring *rx_ring; >> >> Can't we get rid of ring dependency? Maybe there's only a couple fields >> that could be copied here instead of referencing the ring? I just find >> it weird that our drivers often look for something in the ring structure >> to parse a descriptor ._. >> If not, can't it be const? > > You're right, I could put just rx_ring->cached_phctime into this structure. > But I recall you saying that if we access ring for timestamps only this is not a > problem :) Sure, it's not a problem, I just thought it's an overkill to put pointer to the ring here, since it's not needed to parse descriptors. ...checked right now, the function which processes timestamp from a descriptor really needs only ::cached_phctime from the ring, nothing more. Sorta overkill I think :s This phctime would be enough to put here. > >> >>> +}; >>> + >>> +static_assert(offsetof(struct ice_xdp_buff, xdp_buff) == 0); >>> + >>> /* indices into GLINT_ITR registers */ >>> #define ICE_RX_ITR ICE_IDX_ITR0 >>> #define ICE_TX_ITR ICE_IDX_ITR1 [...] >>> + struct ice_xdp_buff xdp_ext; >>> + struct xdp_buff xdp; >>> + }; >> >> ...or you can leave just one xdp_ext (naming it just "xdp") -- for now, >> this union does literally nothing, as xdp_ext contains xdp at its very >> beginning. > > I would like to leave non-meta-related-code rather unaware of existance of > ice_xdp_buff. Why access '&ring->xdp.xdp_buff' or '(struct xdp_buff *)xdp', when > we can do just 'ring->xdp'? Hmm, got it. On point :D > >> >>> /* CL3 - 3rd cacheline starts here */ >>> struct bpf_prog *xdp_prog; >>> u16 rx_offset; [...] >>> +static inline void >>> +ice_xdp_set_meta_srcs(struct xdp_buff *xdp, >> >> Not sure about the naming... But can't propose anything :clownface: >> ice_xdp_init_buff()? Like xdp_init_buff(), but ice_xdp_buff :D > > ice_xdp_init_buff() sound exactly like a custom wrapper for xdp_init_buff(), but > usage of those functions would be quite different. I've contemplated the naming > of this one for some time and think it's good enough as it is, at least it > communicates that function has sth to do with 'xdp' and 'meta' and doesn't sound > like it fills in metadata. ice_xdp_prepare_buff() :D Just kiddin, "set_meta_srcs" is fine, too. >> >>> + union ice_32b_rx_flex_desc *eop_desc, >>> + struct ice_rx_ring *rx_ring) >>> +{ >>> + struct ice_xdp_buff *xdp_ext = (struct ice_xdp_buff *)xdp; >> >> I'd use container_of(), even though it will do the same thing here. >> BTW, is having &xdp_buff at offset 0 still a requirement? > > I've actually forgot about why it is a requirement, but have found my older > github answer to you. > > "AF_XDP implementation also assumes xdp_buff is at the start". > > What I meant by that is xdp_buffs from xsk_pool have only tailroom. > > Maybe I should add a comment about this next to static assert. > Will change to container_of, I guess it's more future-proof. Ah, AF_XDP programs, right. Comment near the assertion + container_of() sounds perfect. [...] Thanks, Olek ^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba ` (4 preceding siblings ...) 2023-05-12 15:25 ` [PATCH RESEND bpf-next 05/15] ice: Introduce ice_xdp_buff Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-12 18:19 ` Stanislav Fomichev 2023-05-12 15:25 ` [PATCH RESEND bpf-next 07/15] ice: Support RX hash XDP hint Larysa Zaremba ` (8 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel Use previously refactored code and create a function that allows XDP code to read HW timestamp. HW timestamp is the first supported hint in the driver, so also add xdp_metadata_ops. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_main.c | 1 + drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index aa32111afd6e..ba1bb8392db1 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -962,4 +962,6 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf) set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags); clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); } + +extern const struct xdp_metadata_ops ice_xdp_md_ops; #endif /* _ICE_H_ */ diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index a1f7c8edc22f..cda6c4a80737 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3378,6 +3378,7 @@ static void ice_set_ops(struct ice_vsi *vsi) netdev->netdev_ops = &ice_netdev_ops; netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; + netdev->xdp_metadata_ops = &ice_xdp_md_ops; ice_set_ethtool_ops(netdev); if (vsi->type != ICE_VSI_PF) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 2515f5f7a2b6..e9589cadf811 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -537,3 +537,25 @@ void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res, spin_unlock(&xdp_ring->tx_lock); } } + +/** + * ice_xdp_rx_hw_ts - HW timestamp XDP hint handler + * @ctx: XDP buff pointer + * @ts_ns: destination address + * + * Copy HW timestamp (if available) to the destination address. + */ +static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns) +{ + const struct ice_xdp_buff *xdp_ext = (void *)ctx; + + if (!ice_ptp_copy_rx_hwts_from_desc(xdp_ext->rx_ring, + xdp_ext->eop_desc, ts_ns)) + return -EOPNOTSUPP; + + return 0; +} + +const struct xdp_metadata_ops ice_xdp_md_ops = { + .xmo_rx_timestamp = ice_xdp_rx_hw_ts, +}; -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint 2023-05-12 15:25 ` [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint Larysa Zaremba @ 2023-05-12 18:19 ` Stanislav Fomichev 2023-05-16 16:17 ` Jesper Dangaard Brouer 0 siblings, 1 reply; 54+ messages in thread From: Stanislav Fomichev @ 2023-05-12 18:19 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On 05/12, Larysa Zaremba wrote: > Use previously refactored code and create a function > that allows XDP code to read HW timestamp. > > HW timestamp is the first supported hint in the driver, > so also add xdp_metadata_ops. > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > drivers/net/ethernet/intel/ice/ice.h | 2 ++ > drivers/net/ethernet/intel/ice/ice_main.c | 1 + > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 22 +++++++++++++++++++ > 3 files changed, 25 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h > index aa32111afd6e..ba1bb8392db1 100644 > --- a/drivers/net/ethernet/intel/ice/ice.h > +++ b/drivers/net/ethernet/intel/ice/ice.h > @@ -962,4 +962,6 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf) > set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags); > clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); > } > + > +extern const struct xdp_metadata_ops ice_xdp_md_ops; > #endif /* _ICE_H_ */ > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c > index a1f7c8edc22f..cda6c4a80737 100644 > --- a/drivers/net/ethernet/intel/ice/ice_main.c > +++ b/drivers/net/ethernet/intel/ice/ice_main.c > @@ -3378,6 +3378,7 @@ static void ice_set_ops(struct ice_vsi *vsi) > > netdev->netdev_ops = &ice_netdev_ops; > netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; > + netdev->xdp_metadata_ops = &ice_xdp_md_ops; > ice_set_ethtool_ops(netdev); > > if (vsi->type != ICE_VSI_PF) > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index 2515f5f7a2b6..e9589cadf811 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -537,3 +537,25 @@ void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res, > spin_unlock(&xdp_ring->tx_lock); > } > } > + > +/** > + * ice_xdp_rx_hw_ts - HW timestamp XDP hint handler > + * @ctx: XDP buff pointer > + * @ts_ns: destination address > + * > + * Copy HW timestamp (if available) to the destination address. > + */ > +static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + > + if (!ice_ptp_copy_rx_hwts_from_desc(xdp_ext->rx_ring, > + xdp_ext->eop_desc, ts_ns)) > + return -EOPNOTSUPP; Per Jesper's recent update, should this be ENODATA? ^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint 2023-05-12 18:19 ` Stanislav Fomichev @ 2023-05-16 16:17 ` Jesper Dangaard Brouer 0 siblings, 0 replies; 54+ messages in thread From: Jesper Dangaard Brouer @ 2023-05-16 16:17 UTC (permalink / raw) To: Stanislav Fomichev, Larysa Zaremba Cc: brouer, bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On 12/05/2023 20.19, Stanislav Fomichev wrote: >> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c >> index 2515f5f7a2b6..e9589cadf811 100644 >> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c >> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c >> @@ -537,3 +537,25 @@ void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res, >> spin_unlock(&xdp_ring->tx_lock); >> } >> } >> + >> +/** >> + * ice_xdp_rx_hw_ts - HW timestamp XDP hint handler >> + * @ctx: XDP buff pointer >> + * @ts_ns: destination address >> + * >> + * Copy HW timestamp (if available) to the destination address. >> + */ >> +static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns) >> +{ >> + const struct ice_xdp_buff *xdp_ext = (void *)ctx; >> + >> + if (!ice_ptp_copy_rx_hwts_from_desc(xdp_ext->rx_ring, >> + xdp_ext->eop_desc, ts_ns)) >> + return -EOPNOTSUPP; > Per Jesper's recent update, should this be ENODATA? > Yes, please :-) https://git.kernel.org/torvalds/c/915efd8a446b ("xdp: bpf_xdp_metadata use EOPNOTSUPP for no driver support") --Jesper ^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH RESEND bpf-next 07/15] ice: Support RX hash XDP hint 2023-05-12 15:25 [PATCH RESEND bpf-next 00/15] new kfunc XDP hints and ice implementation Larysa Zaremba ` (5 preceding siblings ...) 2023-05-12 15:25 ` [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint Larysa Zaremba @ 2023-05-12 15:25 ` Larysa Zaremba 2023-05-12 18:22 ` Stanislav Fomichev 2023-05-12 15:26 ` [PATCH RESEND bpf-next 08/15] ice: Support XDP hints in AF_XDP ZC mode Larysa Zaremba ` (7 subsequent siblings) 14 siblings, 1 reply; 54+ messages in thread From: Larysa Zaremba @ 2023-05-12 15:25 UTC (permalink / raw) To: bpf Cc: Larysa Zaremba, Stanislav Fomichev, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel RX hash XDP hint requests both hash value and type. Type is XDP-specific, so we need a separate way to map these values to the hardware ptypes, so create a lookup table. Instead of creating a new long list, reuse contents of ice_decode_rx_desc_ptype[] through preprocessor. Current hash type enum does not contain ICMP packet type, but ice devices support it, so also add a new type into core code. Then use previously refactored code and create a function that allows XDP code to read RX hash. Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> --- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 412 +++++++++--------- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 72 +++ include/net/xdp.h | 3 + 3 files changed, 283 insertions(+), 204 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h index 89f986a75cc8..d384ddfcb83e 100644 --- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h @@ -673,6 +673,212 @@ struct ice_tlan_ctx { * Use the enum ice_rx_l2_ptype to decode the packet type * ENDIF */ +#define ICE_PTYPES \ + /* L2 Packet types */ \ + ICE_PTT_UNUSED_ENTRY(0), \ + ICE_PTT(1, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2), \ + ICE_PTT_UNUSED_ENTRY(2), \ + ICE_PTT_UNUSED_ENTRY(3), \ + ICE_PTT_UNUSED_ENTRY(4), \ + ICE_PTT_UNUSED_ENTRY(5), \ + ICE_PTT(6, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ + ICE_PTT(7, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ + ICE_PTT_UNUSED_ENTRY(8), \ + ICE_PTT_UNUSED_ENTRY(9), \ + ICE_PTT(10, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ + ICE_PTT(11, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ + ICE_PTT_UNUSED_ENTRY(12), \ + ICE_PTT_UNUSED_ENTRY(13), \ + ICE_PTT_UNUSED_ENTRY(14), \ + ICE_PTT_UNUSED_ENTRY(15), \ + ICE_PTT_UNUSED_ENTRY(16), \ + ICE_PTT_UNUSED_ENTRY(17), \ + ICE_PTT_UNUSED_ENTRY(18), \ + ICE_PTT_UNUSED_ENTRY(19), \ + ICE_PTT_UNUSED_ENTRY(20), \ + ICE_PTT_UNUSED_ENTRY(21), \ + \ + /* Non Tunneled IPv4 */ \ + ICE_PTT(22, IP, IPV4, FRG, NONE, NONE, NOF, NONE, PAY3), \ + ICE_PTT(23, IP, IPV4, NOF, NONE, NONE, NOF, NONE, PAY3), \ + ICE_PTT(24, IP, IPV4, NOF, NONE, NONE, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(25), \ + ICE_PTT(26, IP, IPV4, NOF, NONE, NONE, NOF, TCP, PAY4), \ + ICE_PTT(27, IP, IPV4, NOF, NONE, NONE, NOF, SCTP, PAY4), \ + ICE_PTT(28, IP, IPV4, NOF, NONE, NONE, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> IPv4 */ \ + ICE_PTT(29, IP, IPV4, NOF, IP_IP, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(30, IP, IPV4, NOF, IP_IP, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(31, IP, IPV4, NOF, IP_IP, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(32), \ + ICE_PTT(33, IP, IPV4, NOF, IP_IP, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(34, IP, IPV4, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(35, IP, IPV4, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> IPv6 */ \ + ICE_PTT(36, IP, IPV4, NOF, IP_IP, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(37, IP, IPV4, NOF, IP_IP, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(38, IP, IPV4, NOF, IP_IP, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(39), \ + ICE_PTT(40, IP, IPV4, NOF, IP_IP, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(41, IP, IPV4, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(42, IP, IPV4, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> GRE/NAT */ \ + ICE_PTT(43, IP, IPV4, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), \ + \ + /* IPv4 --> GRE/NAT --> IPv4 */ \ + ICE_PTT(44, IP, IPV4, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(45, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(46, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(47), \ + ICE_PTT(48, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(49, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(50, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> GRE/NAT --> IPv6 */ \ + ICE_PTT(51, IP, IPV4, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(52, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(53, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(54), \ + ICE_PTT(55, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(56, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(57, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> GRE/NAT --> MAC */ \ + ICE_PTT(58, IP, IPV4, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), \ + \ + /* IPv4 --> GRE/NAT --> MAC --> IPv4 */ \ + ICE_PTT(59, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(60, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(61, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(62), \ + ICE_PTT(63, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(64, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(65, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> GRE/NAT -> MAC --> IPv6 */ \ + ICE_PTT(66, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(67, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(68, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(69), \ + ICE_PTT(70, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(71, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(72, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv4 --> GRE/NAT --> MAC/VLAN */ \ + ICE_PTT(73, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), \ + \ + /* IPv4 ---> GRE/NAT -> MAC/VLAN --> IPv4 */ \ + ICE_PTT(74, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(75, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(76, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(77), \ + ICE_PTT(78, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(79, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(80, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv4 -> GRE/NAT -> MAC/VLAN --> IPv6 */ \ + ICE_PTT(81, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(82, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(83, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(84), \ + ICE_PTT(85, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(86, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(87, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), \ + \ + /* Non Tunneled IPv6 */ \ + ICE_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3), \ + ICE_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3), \ + ICE_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(91), \ + ICE_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP, PAY4), \ + ICE_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4), \ + ICE_PTT(94, IP, IPV6, NOF, NONE, NONE, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> IPv4 */ \ + ICE_PTT(95, IP, IPV6, NOF, IP_IP, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(96, IP, IPV6, NOF, IP_IP, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(97, IP, IPV6, NOF, IP_IP, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(98), \ + ICE_PTT(99, IP, IPV6, NOF, IP_IP, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(100, IP, IPV6, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(101, IP, IPV6, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> IPv6 */ \ + ICE_PTT(102, IP, IPV6, NOF, IP_IP, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(103, IP, IPV6, NOF, IP_IP, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(104, IP, IPV6, NOF, IP_IP, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(105), \ + ICE_PTT(106, IP, IPV6, NOF, IP_IP, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(107, IP, IPV6, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(108, IP, IPV6, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT */ \ + ICE_PTT(109, IP, IPV6, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), \ + \ + /* IPv6 --> GRE/NAT -> IPv4 */ \ + ICE_PTT(110, IP, IPV6, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(111, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(112, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(113), \ + ICE_PTT(114, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(115, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(116, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT -> IPv6 */ \ + ICE_PTT(117, IP, IPV6, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(118, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(119, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(120), \ + ICE_PTT(121, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(122, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(123, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT -> MAC */ \ + ICE_PTT(124, IP, IPV6, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), \ + \ + /* IPv6 --> GRE/NAT -> MAC -> IPv4 */ \ + ICE_PTT(125, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(126, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(127, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(128), \ + ICE_PTT(129, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(130, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(131, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT -> MAC -> IPv6 */ \ + ICE_PTT(132, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(133, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(134, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(135), \ + ICE_PTT(136, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(137, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(138, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT -> MAC/VLAN */ \ + ICE_PTT(139, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), \ + \ + /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv4 */ \ + ICE_PTT(140, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), \ + ICE_PTT(141, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), \ + ICE_PTT(142, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(143), \ + ICE_PTT(144, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), \ + ICE_PTT(145, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), \ + ICE_PTT(146, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), \ + \ + /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv6 */ \ + ICE_PTT(147, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), \ + ICE_PTT(148, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), \ + ICE_PTT(149, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), \ + ICE_PTT_UNUSED_ENTRY(150), \ + ICE_PTT(151, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), \ + ICE_PTT(152, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), \ + ICE_PTT(153, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), + +#define ICE_NUM_DEFINED_PTYPES 154 /* macro to make the table lines short, use explicit indexing with [PTYPE] */ #define ICE_PTT(PTYPE, OUTER_IP, OUTER_IP_VER, OUTER_FRAG, T, TE, TEF, I, PL)\ @@ -695,212 +901,10 @@ struct ice_tlan_ctx { /* Lookup table mapping in the 10-bit HW PTYPE to the bit field for decoding */ static const struct ice_rx_ptype_decoded ice_ptype_lkup[BIT(10)] = { - /* L2 Packet types */ - ICE_PTT_UNUSED_ENTRY(0), - ICE_PTT(1, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2), - ICE_PTT_UNUSED_ENTRY(2), - ICE_PTT_UNUSED_ENTRY(3), - ICE_PTT_UNUSED_ENTRY(4), - ICE_PTT_UNUSED_ENTRY(5), - ICE_PTT(6, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), - ICE_PTT(7, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), - ICE_PTT_UNUSED_ENTRY(8), - ICE_PTT_UNUSED_ENTRY(9), - ICE_PTT(10, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), - ICE_PTT(11, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), - ICE_PTT_UNUSED_ENTRY(12), - ICE_PTT_UNUSED_ENTRY(13), - ICE_PTT_UNUSED_ENTRY(14), - ICE_PTT_UNUSED_ENTRY(15), - ICE_PTT_UNUSED_ENTRY(16), - ICE_PTT_UNUSED_ENTRY(17), - ICE_PTT_UNUSED_ENTRY(18), - ICE_PTT_UNUSED_ENTRY(19), - ICE_PTT_UNUSED_ENTRY(20), - ICE_PTT_UNUSED_ENTRY(21), - - /* Non Tunneled IPv4 */ - ICE_PTT(22, IP, IPV4, FRG, NONE, NONE, NOF, NONE, PAY3), - ICE_PTT(23, IP, IPV4, NOF, NONE, NONE, NOF, NONE, PAY3), - ICE_PTT(24, IP, IPV4, NOF, NONE, NONE, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(25), - ICE_PTT(26, IP, IPV4, NOF, NONE, NONE, NOF, TCP, PAY4), - ICE_PTT(27, IP, IPV4, NOF, NONE, NONE, NOF, SCTP, PAY4), - ICE_PTT(28, IP, IPV4, NOF, NONE, NONE, NOF, ICMP, PAY4), - - /* IPv4 --> IPv4 */ - ICE_PTT(29, IP, IPV4, NOF, IP_IP, IPV4, FRG, NONE, PAY3), - ICE_PTT(30, IP, IPV4, NOF, IP_IP, IPV4, NOF, NONE, PAY3), - ICE_PTT(31, IP, IPV4, NOF, IP_IP, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(32), - ICE_PTT(33, IP, IPV4, NOF, IP_IP, IPV4, NOF, TCP, PAY4), - ICE_PTT(34, IP, IPV4, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), - ICE_PTT(35, IP, IPV4, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), - - /* IPv4 --> IPv6 */ - ICE_PTT(36, IP, IPV4, NOF, IP_IP, IPV6, FRG, NONE, PAY3), - ICE_PTT(37, IP, IPV4, NOF, IP_IP, IPV6, NOF, NONE, PAY3), - ICE_PTT(38, IP, IPV4, NOF, IP_IP, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(39), - ICE_PTT(40, IP, IPV4, NOF, IP_IP, IPV6, NOF, TCP, PAY4), - ICE_PTT(41, IP, IPV4, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), - ICE_PTT(42, IP, IPV4, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), - - /* IPv4 --> GRE/NAT */ - ICE_PTT(43, IP, IPV4, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), - - /* IPv4 --> GRE/NAT --> IPv4 */ - ICE_PTT(44, IP, IPV4, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), - ICE_PTT(45, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), - ICE_PTT(46, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(47), - ICE_PTT(48, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), - ICE_PTT(49, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), - ICE_PTT(50, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), - - /* IPv4 --> GRE/NAT --> IPv6 */ - ICE_PTT(51, IP, IPV4, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), - ICE_PTT(52, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), - ICE_PTT(53, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(54), - ICE_PTT(55, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), - ICE_PTT(56, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), - ICE_PTT(57, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), - - /* IPv4 --> GRE/NAT --> MAC */ - ICE_PTT(58, IP, IPV4, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), - - /* IPv4 --> GRE/NAT --> MAC --> IPv4 */ - ICE_PTT(59, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), - ICE_PTT(60, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), - ICE_PTT(61, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(62), - ICE_PTT(63, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), - ICE_PTT(64, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), - ICE_PTT(65, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), - - /* IPv4 --> GRE/NAT -> MAC --> IPv6 */ - ICE_PTT(66, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), - ICE_PTT(67, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), - ICE_PTT(68, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(69), - ICE_PTT(70, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), - ICE_PTT(71, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), - ICE_PTT(72, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), - - /* IPv4 --> GRE/NAT --> MAC/VLAN */ - ICE_PTT(73, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), - - /* IPv4 ---> GRE/NAT -> MAC/VLAN --> IPv4 */ - ICE_PTT(74, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), - ICE_PTT(75, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), - ICE_PTT(76, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(77), - ICE_PTT(78, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), - ICE_PTT(79, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), - ICE_PTT(80, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), - - /* IPv4 -> GRE/NAT -> MAC/VLAN --> IPv6 */ - ICE_PTT(81, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), - ICE_PTT(82, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), - ICE_PTT(83, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(84), - ICE_PTT(85, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), - ICE_PTT(86, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), - ICE_PTT(87, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), - - /* Non Tunneled IPv6 */ - ICE_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3), - ICE_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3), - ICE_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(91), - ICE_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP, PAY4), - ICE_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4), - ICE_PTT(94, IP, IPV6, NOF, NONE, NONE, NOF, ICMP, PAY4), - - /* IPv6 --> IPv4 */ - ICE_PTT(95, IP, IPV6, NOF, IP_IP, IPV4, FRG, NONE, PAY3), - ICE_PTT(96, IP, IPV6, NOF, IP_IP, IPV4, NOF, NONE, PAY3), - ICE_PTT(97, IP, IPV6, NOF, IP_IP, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(98), - ICE_PTT(99, IP, IPV6, NOF, IP_IP, IPV4, NOF, TCP, PAY4), - ICE_PTT(100, IP, IPV6, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), - ICE_PTT(101, IP, IPV6, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), - - /* IPv6 --> IPv6 */ - ICE_PTT(102, IP, IPV6, NOF, IP_IP, IPV6, FRG, NONE, PAY3), - ICE_PTT(103, IP, IPV6, NOF, IP_IP, IPV6, NOF, NONE, PAY3), - ICE_PTT(104, IP, IPV6, NOF, IP_IP, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(105), - ICE_PTT(106, IP, IPV6, NOF, IP_IP, IPV6, NOF, TCP, PAY4), - ICE_PTT(107, IP, IPV6, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), - ICE_PTT(108, IP, IPV6, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT */ - ICE_PTT(109, IP, IPV6, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), - - /* IPv6 --> GRE/NAT -> IPv4 */ - ICE_PTT(110, IP, IPV6, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), - ICE_PTT(111, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), - ICE_PTT(112, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(113), - ICE_PTT(114, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), - ICE_PTT(115, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), - ICE_PTT(116, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT -> IPv6 */ - ICE_PTT(117, IP, IPV6, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), - ICE_PTT(118, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), - ICE_PTT(119, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(120), - ICE_PTT(121, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), - ICE_PTT(122, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), - ICE_PTT(123, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT -> MAC */ - ICE_PTT(124, IP, IPV6, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), - - /* IPv6 --> GRE/NAT -> MAC -> IPv4 */ - ICE_PTT(125, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), - ICE_PTT(126, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), - ICE_PTT(127, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(128), - ICE_PTT(129, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), - ICE_PTT(130, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), - ICE_PTT(131, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT -> MAC -> IPv6 */ - ICE_PTT(132, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), - ICE_PTT(133, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), - ICE_PTT(134, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(135), - ICE_PTT(136, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), - ICE_PTT(137, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), - ICE_PTT(138, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT -> MAC/VLAN */ - ICE_PTT(139, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), - - /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv4 */ - ICE_PTT(140, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), - ICE_PTT(141, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), - ICE_PTT(142, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(143), - ICE_PTT(144, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), - ICE_PTT(145, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), - ICE_PTT(146, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), - - /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv6 */ - ICE_PTT(147, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), - ICE_PTT(148, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), - ICE_PTT(149, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), - ICE_PTT_UNUSED_ENTRY(150), - ICE_PTT(151, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), - ICE_PTT(152, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), - ICE_PTT(153, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), + ICE_PTYPES /* unused entries */ - [154 ... 1023] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 } + [ICE_NUM_DEFINED_PTYPES ... 1023] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; static inline struct ice_rx_ptype_decoded ice_decode_rx_desc_ptype(u16 ptype) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index e9589cadf811..1caa73644e7b 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -556,6 +556,78 @@ static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns) return 0; } +/* Define a ptype index -> XDP hash type lookup table. + * It uses the same ptype definitions as ice_decode_rx_desc_ptype[], + * avoiding possible copy-paste errors. + */ +#undef ICE_PTT +#undef ICE_PTT_UNUSED_ENTRY + +#define ICE_PTT(PTYPE, OUTER_IP, OUTER_IP_VER, OUTER_FRAG, T, TE, TEF, I, PL)\ + [PTYPE] = XDP_RSS_L3_##OUTER_IP_VER | XDP_RSS_L4_##I | XDP_RSS_TYPE_##PL + +#define ICE_PTT_UNUSED_ENTRY(PTYPE) [PTYPE] = 0 + +/* A few supplementary definitions for when XDP hash types do not coincide + * with what can be generated from ptype definitions + * by means of preprocessor concatenation. + */ +#define XDP_RSS_L3_NONE XDP_RSS_TYPE_NONE +#define XDP_RSS_L4_NONE XDP_RSS_TYPE_NONE +#define XDP_RSS_TYPE_PAY2 XDP_RSS_TYPE_L2 +#define XDP_RSS_TYPE_PAY3 XDP_RSS_TYPE_NONE +#define XDP_RSS_TYPE_PAY4 XDP_RSS_L4 + +static const enum xdp_rss_hash_type +ice_ptype_to_xdp_hash[ICE_NUM_DEFINED_PTYPES] = { + ICE_PTYPES +}; + +#undef XDP_RSS_L3_NONE +#undef XDP_RSS_L4_NONE +#undef XDP_RSS_TYPE_PAY2 +#undef XDP_RSS_TYPE_PAY3 +#undef XDP_RSS_TYPE_PAY4 + +#undef ICE_PTT +#undef ICE_PTT_UNUSED_ENTRY + +/** + * ice_xdp_rx_hash_type - Get XDP-specific hash type from the RX descriptor + * @eop_desc: End of Packet descriptor + */ +static enum xdp_rss_hash_type +ice_xdp_rx_hash_type(union ice_32b_rx_flex_desc *eop_desc) +{ + u16 ptype = ice_get_ptype(eop_desc); + + if (unlikely(ptype >= ICE_NUM_DEFINED_PTYPES)) + return 0; + + return ice_ptype_to_xdp_hash[ptype]; +} + +/** + * ice_xdp_rx_hash - RX hash XDP hint handler + * @ctx: XDP buff pointer + * @hash: hash destination address + * @rss_type: XDP hash type destination address + * + * Copy RX hash (if available) and its type to the destination address. + */ +static int ice_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, + enum xdp_rss_hash_type *rss_type) +{ + const struct ice_xdp_buff *xdp_ext = (void *)ctx; + + *rss_type = ice_xdp_rx_hash_type(xdp_ext->eop_desc); + if (!ice_copy_rx_hash_from_desc(xdp_ext->eop_desc, hash)) + return -EOPNOTSUPP; + + return 0; +} + const struct xdp_metadata_ops ice_xdp_md_ops = { .xmo_rx_timestamp = ice_xdp_rx_hw_ts, + .xmo_rx_hash = ice_xdp_rx_hash, }; diff --git a/include/net/xdp.h b/include/net/xdp.h index d1c5381fc95f..6381560efae2 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -417,6 +417,7 @@ enum xdp_rss_hash_type { XDP_RSS_L4_UDP = BIT(5), XDP_RSS_L4_SCTP = BIT(6), XDP_RSS_L4_IPSEC = BIT(7), /* L4 based hash include IPSEC SPI */ + XDP_RSS_L4_ICMP = BIT(8), /* Second part: RSS hash type combinations used for driver HW mapping */ XDP_RSS_TYPE_NONE = 0, @@ -432,11 +433,13 @@ enum xdp_rss_hash_type { XDP_RSS_TYPE_L4_IPV4_UDP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_UDP, XDP_RSS_TYPE_L4_IPV4_SCTP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_SCTP, XDP_RSS_TYPE_L4_IPV4_IPSEC = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_IPSEC, + XDP_RSS_TYPE_L4_IPV4_ICMP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_ICMP, XDP_RSS_TYPE_L4_IPV6_TCP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_TCP, XDP_RSS_TYPE_L4_IPV6_UDP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_UDP, XDP_RSS_TYPE_L4_IPV6_SCTP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_SCTP, XDP_RSS_TYPE_L4_IPV6_IPSEC = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_IPSEC, + XDP_RSS_TYPE_L4_IPV6_ICMP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_ICMP, XDP_RSS_TYPE_L4_IPV6_TCP_EX = XDP_RSS_TYPE_L4_IPV6_TCP | XDP_RSS_L3_DYNHDR, XDP_RSS_TYPE_L4_IPV6_UDP_EX = XDP_RSS_TYPE_L4_IPV6_UDP | XDP_RSS_L3_DYNHDR, -- 2.35.3 ^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH RESEND bpf-next 07/15] ice: Support RX hash XDP hint 2023-05-12 15:25 ` [PATCH RESEND bpf-next 07/15] ice: Support RX hash XDP hint Larysa Zaremba @ 2023-05-12 18:22 ` Stanislav Fomichev 2023-05-15 13:46 ` Larysa Zaremba 0 siblings, 1 reply; 54+ messages in thread From: Stanislav Fomichev @ 2023-05-12 18:22 UTC (permalink / raw) To: Larysa Zaremba Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Jiri Olsa, Jesse Brandeburg, Tony Nguyen, Anatoly Burakov, Jesper Dangaard Brouer, Alexander Lobakin, Magnus Karlsson, Maryam Tahhan, xdp-hints, netdev, intel-wired-lan, linux-kernel On 05/12, Larysa Zaremba wrote: > RX hash XDP hint requests both hash value and type. > Type is XDP-specific, so we need a separate way to map > these values to the hardware ptypes, so create a lookup table. > > Instead of creating a new long list, reuse contents > of ice_decode_rx_desc_ptype[] through preprocessor. > > Current hash type enum does not contain ICMP packet type, > but ice devices support it, so also add a new type into core code. > > Then use previously refactored code and create a function > that allows XDP code to read RX hash. > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 412 +++++++++--------- > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 72 +++ > include/net/xdp.h | 3 + > 3 files changed, 283 insertions(+), 204 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h > index 89f986a75cc8..d384ddfcb83e 100644 > --- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h > +++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h > @@ -673,6 +673,212 @@ struct ice_tlan_ctx { > * Use the enum ice_rx_l2_ptype to decode the packet type > * ENDIF > */ > +#define ICE_PTYPES \ > + /* L2 Packet types */ \ > + ICE_PTT_UNUSED_ENTRY(0), \ > + ICE_PTT(1, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2), \ > + ICE_PTT_UNUSED_ENTRY(2), \ > + ICE_PTT_UNUSED_ENTRY(3), \ > + ICE_PTT_UNUSED_ENTRY(4), \ > + ICE_PTT_UNUSED_ENTRY(5), \ > + ICE_PTT(6, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ > + ICE_PTT(7, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ > + ICE_PTT_UNUSED_ENTRY(8), \ > + ICE_PTT_UNUSED_ENTRY(9), \ > + ICE_PTT(10, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ > + ICE_PTT(11, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), \ > + ICE_PTT_UNUSED_ENTRY(12), \ > + ICE_PTT_UNUSED_ENTRY(13), \ > + ICE_PTT_UNUSED_ENTRY(14), \ > + ICE_PTT_UNUSED_ENTRY(15), \ > + ICE_PTT_UNUSED_ENTRY(16), \ > + ICE_PTT_UNUSED_ENTRY(17), \ > + ICE_PTT_UNUSED_ENTRY(18), \ > + ICE_PTT_UNUSED_ENTRY(19), \ > + ICE_PTT_UNUSED_ENTRY(20), \ > + ICE_PTT_UNUSED_ENTRY(21), \ > + \ > + /* Non Tunneled IPv4 */ \ > + ICE_PTT(22, IP, IPV4, FRG, NONE, NONE, NOF, NONE, PAY3), \ > + ICE_PTT(23, IP, IPV4, NOF, NONE, NONE, NOF, NONE, PAY3), \ > + ICE_PTT(24, IP, IPV4, NOF, NONE, NONE, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(25), \ > + ICE_PTT(26, IP, IPV4, NOF, NONE, NONE, NOF, TCP, PAY4), \ > + ICE_PTT(27, IP, IPV4, NOF, NONE, NONE, NOF, SCTP, PAY4), \ > + ICE_PTT(28, IP, IPV4, NOF, NONE, NONE, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> IPv4 */ \ > + ICE_PTT(29, IP, IPV4, NOF, IP_IP, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(30, IP, IPV4, NOF, IP_IP, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(31, IP, IPV4, NOF, IP_IP, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(32), \ > + ICE_PTT(33, IP, IPV4, NOF, IP_IP, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(34, IP, IPV4, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(35, IP, IPV4, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> IPv6 */ \ > + ICE_PTT(36, IP, IPV4, NOF, IP_IP, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(37, IP, IPV4, NOF, IP_IP, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(38, IP, IPV4, NOF, IP_IP, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(39), \ > + ICE_PTT(40, IP, IPV4, NOF, IP_IP, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(41, IP, IPV4, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(42, IP, IPV4, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> GRE/NAT */ \ > + ICE_PTT(43, IP, IPV4, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv4 --> GRE/NAT --> IPv4 */ \ > + ICE_PTT(44, IP, IPV4, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(45, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(46, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(47), \ > + ICE_PTT(48, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(49, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(50, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> GRE/NAT --> IPv6 */ \ > + ICE_PTT(51, IP, IPV4, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(52, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(53, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(54), \ > + ICE_PTT(55, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(56, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(57, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> GRE/NAT --> MAC */ \ > + ICE_PTT(58, IP, IPV4, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv4 --> GRE/NAT --> MAC --> IPv4 */ \ > + ICE_PTT(59, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(60, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(61, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(62), \ > + ICE_PTT(63, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(64, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(65, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> GRE/NAT -> MAC --> IPv6 */ \ > + ICE_PTT(66, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(67, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(68, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(69), \ > + ICE_PTT(70, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(71, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(72, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 --> GRE/NAT --> MAC/VLAN */ \ > + ICE_PTT(73, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv4 ---> GRE/NAT -> MAC/VLAN --> IPv4 */ \ > + ICE_PTT(74, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(75, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(76, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(77), \ > + ICE_PTT(78, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(79, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(80, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv4 -> GRE/NAT -> MAC/VLAN --> IPv6 */ \ > + ICE_PTT(81, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(82, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(83, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(84), \ > + ICE_PTT(85, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(86, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(87, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* Non Tunneled IPv6 */ \ > + ICE_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3), \ > + ICE_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3), \ > + ICE_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(91), \ > + ICE_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP, PAY4), \ > + ICE_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4), \ > + ICE_PTT(94, IP, IPV6, NOF, NONE, NONE, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> IPv4 */ \ > + ICE_PTT(95, IP, IPV6, NOF, IP_IP, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(96, IP, IPV6, NOF, IP_IP, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(97, IP, IPV6, NOF, IP_IP, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(98), \ > + ICE_PTT(99, IP, IPV6, NOF, IP_IP, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(100, IP, IPV6, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(101, IP, IPV6, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> IPv6 */ \ > + ICE_PTT(102, IP, IPV6, NOF, IP_IP, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(103, IP, IPV6, NOF, IP_IP, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(104, IP, IPV6, NOF, IP_IP, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(105), \ > + ICE_PTT(106, IP, IPV6, NOF, IP_IP, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(107, IP, IPV6, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(108, IP, IPV6, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT */ \ > + ICE_PTT(109, IP, IPV6, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv6 --> GRE/NAT -> IPv4 */ \ > + ICE_PTT(110, IP, IPV6, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(111, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(112, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(113), \ > + ICE_PTT(114, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(115, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(116, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT -> IPv6 */ \ > + ICE_PTT(117, IP, IPV6, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(118, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(119, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(120), \ > + ICE_PTT(121, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(122, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(123, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC */ \ > + ICE_PTT(124, IP, IPV6, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC -> IPv4 */ \ > + ICE_PTT(125, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(126, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(127, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(128), \ > + ICE_PTT(129, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(130, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(131, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC -> IPv6 */ \ > + ICE_PTT(132, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(133, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(134, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(135), \ > + ICE_PTT(136, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(137, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(138, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC/VLAN */ \ > + ICE_PTT(139, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv4 */ \ > + ICE_PTT(140, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3), \ > + ICE_PTT(141, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3), \ > + ICE_PTT(142, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(143), \ > + ICE_PTT(144, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP, PAY4), \ > + ICE_PTT(145, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4), \ > + ICE_PTT(146, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4), \ > + \ > + /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv6 */ \ > + ICE_PTT(147, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3), \ > + ICE_PTT(148, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3), \ > + ICE_PTT(149, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP, PAY4), \ > + ICE_PTT_UNUSED_ENTRY(150), \ > + ICE_PTT(151, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP, PAY4), \ > + ICE_PTT(152, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4), \ > + ICE_PTT(153, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4), > + > +#define ICE_NUM_DEFINED_PTYPES 154 > > /* macro to make the table lines short, use explicit indexing with [PTYPE] */ > #define ICE_PTT(PTYPE, OUTER_IP, OUTER_IP_VER, OUTER_FRAG, T, TE, TEF, I, PL)\ > @@ -695,212 +901,10 @@ struct ice_tlan_ctx { > > /* Lookup table mapping in the 10-bit HW PTYPE to the bit field for decoding */ > static const struct ice_rx_ptype_decoded ice_ptype_lkup[BIT(10)] = { > - /* L2 Packet types */ > - ICE_PTT_UNUSED_ENTRY(0), > - ICE_PTT(1, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2), > - ICE_PTT_UNUSED_ENTRY(2), > - ICE_PTT_UNUSED_ENTRY(3), > - ICE_PTT_UNUSED_ENTRY(4), > - ICE_PTT_UNUSED_ENTRY(5), > - ICE_PTT(6, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), > - ICE_PTT(7, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), > - ICE_PTT_UNUSED_ENTRY(8), > - ICE_PTT_UNUSED_ENTRY(9), > - ICE_PTT(10, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), > - ICE_PTT(11, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE), > - ICE_PTT_UNUSED_ENTRY(12), > - ICE_PTT_UNUSED_ENTRY(13), > - ICE_PTT_UNUSED_ENTRY(14), > - ICE_PTT_UNUSED_ENTRY(15), > - ICE_PTT_UNUSED_ENTRY(16), > - ICE_PTT_UNUSED_ENTRY(17), > - ICE_PTT_UNUSED_ENTRY(18), > - ICE_PTT_UNUSED_ENTRY(19), > - ICE_PTT_UNUSED_ENTRY(20), > - ICE_PTT_UNUSED_ENTRY(21), > - > - /* Non Tunneled IPv4 */ > - ICE_PTT(22, IP, IPV4, FRG, NONE, NONE, NOF, NONE, PAY3), > - ICE_PTT(23, IP, IPV4, NOF, NONE, NONE, NOF, NONE, PAY3), > - ICE_PTT(24, IP, IPV4, NOF, NONE, NONE, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(25), > - ICE_PTT(26, IP, IPV4, NOF, NONE, NONE, NOF, TCP, PAY4), > - ICE_PTT(27, IP, IPV4, NOF, NONE, NONE, NOF, SCTP, PAY4), > - ICE_PTT(28, IP, IPV4, NOF, NONE, NONE, NOF, ICMP, PAY4), > - > - /* IPv4 --> IPv4 */ > - ICE_PTT(29, IP, IPV4, NOF, IP_IP, IPV4, FRG, NONE, PAY3), > - ICE_PTT(30, IP, IPV4, NOF, IP_IP, IPV4, NOF, NONE, PAY3), > - ICE_PTT(31, IP, IPV4, NOF, IP_IP, IPV4, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(32), > - ICE_PTT(33, IP, IPV4, NOF, IP_IP, IPV4, NOF, TCP, PAY4), > - ICE_PTT(34, IP, IPV4, NOF, IP_IP, IPV4, NOF, SCTP, PAY4), > - ICE_PTT(35, IP, IPV4, NOF, IP_IP, IPV4, NOF, ICMP, PAY4), > - > - /* IPv4 --> IPv6 */ > - ICE_PTT(36, IP, IPV4, NOF, IP_IP, IPV6, FRG, NONE, PAY3), > - ICE_PTT(37, IP, IPV4, NOF, IP_IP, IPV6, NOF, NONE, PAY3), > - ICE_PTT(38, IP, IPV4, NOF, IP_IP, IPV6, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(39), > - ICE_PTT(40, IP, IPV4, NOF, IP_IP, IPV6, NOF, TCP, PAY4), > - ICE_PTT(41, IP, IPV4, NOF, IP_IP, IPV6, NOF, SCTP, PAY4), > - ICE_PTT(42, IP, IPV4, NOF, IP_IP, IPV6, NOF, ICMP, PAY4), > - > - /* IPv4 --> GRE/NAT */ > - ICE_PTT(43, IP, IPV4, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3), > - > - /* IPv4 --> GRE/NAT --> IPv4 */ > - ICE_PTT(44, IP, IPV4, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3), > - ICE_PTT(45, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3), > - ICE_PTT(46, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(47), > - ICE_PTT(48, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, TCP, PAY4), > - ICE_PTT(49, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4), > - ICE_PTT(50, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4), > - > - /* IPv4 --> GRE/NAT --> IPv6 */ > - ICE_PTT(51, IP, IPV4, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3), > - ICE_PTT(52, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3), > - ICE_PTT(53, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(54), > - ICE_PTT(55, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, TCP, PAY4), > - ICE_PTT(56, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4), > - ICE_PTT(57, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4), > - > - /* IPv4 --> GRE/NAT --> MAC */ > - ICE_PTT(58, IP, IPV4, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3), > - > - /* IPv4 --> GRE/NAT --> MAC --> IPv4 */ > - ICE_PTT(59, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3), > - ICE_PTT(60, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3), > - ICE_PTT(61, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP, PAY4), > - ICE_PTT_UNUSED_ENTRY(62), > - ICE_PTT(6