提交 48c0481e 编写于 作者: I Ioana Ciornei 提交者: David S. Miller

dpaa2-eth: return num_enqueued frames from enqueue callback

The enqueue dpaa2-eth callback now returns the number of successfully
enqueued frames. This is a preliminary patch necessary for adding
support for bulk ring mode enqueue.
Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 788f87ac
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/* Copyright 2014-2016 Freescale Semiconductor Inc. /* Copyright 2014-2016 Freescale Semiconductor Inc.
* Copyright 2016-2019 NXP * Copyright 2016-2020 NXP
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -268,7 +268,7 @@ static int xdp_enqueue(struct dpaa2_eth_priv *priv, struct dpaa2_fd *fd, ...@@ -268,7 +268,7 @@ static int xdp_enqueue(struct dpaa2_eth_priv *priv, struct dpaa2_fd *fd,
fq = &priv->fq[queue_id]; fq = &priv->fq[queue_id];
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
err = priv->enqueue(priv, fq, fd, 0); err = priv->enqueue(priv, fq, fd, 0, NULL);
if (err != -EBUSY) if (err != -EBUSY)
break; break;
} }
...@@ -847,7 +847,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) ...@@ -847,7 +847,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
* the Tx confirmation callback for this frame * the Tx confirmation callback for this frame
*/ */
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
err = priv->enqueue(priv, fq, &fd, prio); err = priv->enqueue(priv, fq, &fd, prio, NULL);
if (err != -EBUSY) if (err != -EBUSY)
break; break;
} }
...@@ -1937,7 +1937,7 @@ static int dpaa2_eth_xdp_xmit_frame(struct net_device *net_dev, ...@@ -1937,7 +1937,7 @@ static int dpaa2_eth_xdp_xmit_frame(struct net_device *net_dev,
fq = &priv->fq[smp_processor_id() % dpaa2_eth_queue_count(priv)]; fq = &priv->fq[smp_processor_id() % dpaa2_eth_queue_count(priv)];
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
err = priv->enqueue(priv, fq, &fd, 0); err = priv->enqueue(priv, fq, &fd, 0, NULL);
if (err != -EBUSY) if (err != -EBUSY)
break; break;
} }
...@@ -2523,19 +2523,31 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) ...@@ -2523,19 +2523,31 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
static inline int dpaa2_eth_enqueue_qd(struct dpaa2_eth_priv *priv, static inline int dpaa2_eth_enqueue_qd(struct dpaa2_eth_priv *priv,
struct dpaa2_eth_fq *fq, struct dpaa2_eth_fq *fq,
struct dpaa2_fd *fd, u8 prio) struct dpaa2_fd *fd, u8 prio,
int *frames_enqueued)
{ {
return dpaa2_io_service_enqueue_qd(fq->channel->dpio, int err;
priv->tx_qdid, prio,
fq->tx_qdbin, fd); err = dpaa2_io_service_enqueue_qd(fq->channel->dpio,
priv->tx_qdid, prio,
fq->tx_qdbin, fd);
if (!err && frames_enqueued)
*frames_enqueued = 1;
return err;
} }
static inline int dpaa2_eth_enqueue_fq(struct dpaa2_eth_priv *priv, static inline int dpaa2_eth_enqueue_fq(struct dpaa2_eth_priv *priv,
struct dpaa2_eth_fq *fq, struct dpaa2_eth_fq *fq,
struct dpaa2_fd *fd, u8 prio) struct dpaa2_fd *fd, u8 prio,
int *frames_enqueued)
{ {
return dpaa2_io_service_enqueue_fq(fq->channel->dpio, int err;
fq->tx_fqid[prio], fd);
err = dpaa2_io_service_enqueue_fq(fq->channel->dpio,
fq->tx_fqid[prio], fd);
if (!err && frames_enqueued)
*frames_enqueued = 1;
return err;
} }
static void set_enqueue_mode(struct dpaa2_eth_priv *priv) static void set_enqueue_mode(struct dpaa2_eth_priv *priv)
......
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
/* Copyright 2014-2016 Freescale Semiconductor Inc. /* Copyright 2014-2016 Freescale Semiconductor Inc.
* Copyright 2016 NXP * Copyright 2016-2020 NXP
*/ */
#ifndef __DPAA2_ETH_H #ifndef __DPAA2_ETH_H
...@@ -371,7 +371,8 @@ struct dpaa2_eth_priv { ...@@ -371,7 +371,8 @@ struct dpaa2_eth_priv {
struct dpaa2_eth_fq fq[DPAA2_ETH_MAX_QUEUES]; struct dpaa2_eth_fq fq[DPAA2_ETH_MAX_QUEUES];
int (*enqueue)(struct dpaa2_eth_priv *priv, int (*enqueue)(struct dpaa2_eth_priv *priv,
struct dpaa2_eth_fq *fq, struct dpaa2_eth_fq *fq,
struct dpaa2_fd *fd, u8 prio); struct dpaa2_fd *fd, u8 prio,
int *frames_enqueued);
u8 num_channels; u8 num_channels;
struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS]; struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册