aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
diff options
context:
space:
mode:
authorGravatar Mark Brown <broonie@kernel.org> 2024-02-01 17:45:32 +0000
committerGravatar Mark Brown <broonie@kernel.org> 2024-02-01 17:45:32 +0000
commite81fdba0208666b65bafeaba814874b4d6e5edde (patch)
tree5de26e8be4ca1801ca27bffe25c129d29b13dba9 /drivers/net/ethernet/intel/ice/ice_txrx_lib.h
parentASoC: amd: acp: Fix support for a Huawei Matebook laptop (diff)
parentALSA: hda: cs35l56: Remove unused test stub function (diff)
downloadlinux-e81fdba0208666b65bafeaba814874b4d6e5edde.tar.gz
linux-e81fdba0208666b65bafeaba814874b4d6e5edde.tar.bz2
linux-e81fdba0208666b65bafeaba814874b4d6e5edde.zip
ALSA: Various fixes for Cirrus Logic CS35L56 support
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: These patches fixe various things that were undocumented, unknown or uncertain when the original driver code was written. And also a few things that were just bugs.
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_txrx_lib.h')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_txrx_lib.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
index 762047508619..afcead4baef4 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.h
@@ -12,26 +12,39 @@
* act: action to store onto Rx buffers related to XDP buffer parts
*
* Set action that should be taken before putting Rx buffer from first frag
- * to one before last. Last one is handled by caller of this function as it
- * is the EOP frag that is currently being processed. This function is
- * supposed to be called only when XDP buffer contains frags.
+ * to the last.
*/
static inline void
ice_set_rx_bufs_act(struct xdp_buff *xdp, const struct ice_rx_ring *rx_ring,
const unsigned int act)
{
- const struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
- u32 first = rx_ring->first_desc;
- u32 nr_frags = sinfo->nr_frags;
+ u32 sinfo_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags;
+ u32 nr_frags = rx_ring->nr_frags + 1;
+ u32 idx = rx_ring->first_desc;
u32 cnt = rx_ring->count;
struct ice_rx_buf *buf;
for (int i = 0; i < nr_frags; i++) {
- buf = &rx_ring->rx_buf[first];
+ buf = &rx_ring->rx_buf[idx];
buf->act = act;
- if (++first == cnt)
- first = 0;
+ if (++idx == cnt)
+ idx = 0;
+ }
+
+ /* adjust pagecnt_bias on frags freed by XDP prog */
+ if (sinfo_frags < rx_ring->nr_frags && act == ICE_XDP_CONSUMED) {
+ u32 delta = rx_ring->nr_frags - sinfo_frags;
+
+ while (delta) {
+ if (idx == 0)
+ idx = cnt - 1;
+ else
+ idx--;
+ buf = &rx_ring->rx_buf[idx];
+ buf->pagecnt_bias--;
+ delta--;
+ }
}
}