realtek: eth: Add return value to rteth_setup_ring_buffer()
In the future this function will work on page_pool and might fail. Add a return code to it and handle it where needed. Link: https://github.com/openwrt/openwrt/pull/23483 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
parent
0a80500fb0
commit
8508bcb42e
@ -603,7 +603,7 @@ static void rteth_931x_hw_en_rxtx(struct rteth_ctrl *ctrl)
|
|||||||
regmap_write(ctrl->map, ctrl->r->mac_force_mode_ctrl, 0x2a1d);
|
regmap_write(ctrl->map, ctrl->r->mac_force_mode_ctrl, 0x2a1d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rteth_setup_ring_buffer(struct rteth_ctrl *ctrl)
|
static int rteth_setup_ring_buffer(struct rteth_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
dma_addr_t rx_buf_dma = ctrl->rx_buf_dma;
|
dma_addr_t rx_buf_dma = ctrl->rx_buf_dma;
|
||||||
char *rx_buf = ctrl->rx_buf;
|
char *rx_buf = ctrl->rx_buf;
|
||||||
@ -638,6 +638,8 @@ static void rteth_setup_ring_buffer(struct rteth_ctrl *ctrl)
|
|||||||
ctrl->tx_data[r].ring[RTETH_TX_RING_SIZE - 1] |= WRAP;
|
ctrl->tx_data[r].ring[RTETH_TX_RING_SIZE - 1] |= WRAP;
|
||||||
ctrl->tx_data[r].slot = 0;
|
ctrl->tx_data[r].slot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rteth_839x_setup_notify_ring_buffer(struct rteth_ctrl *ctrl)
|
static void rteth_839x_setup_notify_ring_buffer(struct rteth_ctrl *ctrl)
|
||||||
@ -701,6 +703,7 @@ static void rteth_931x_hw_init(struct rteth_ctrl *ctrl)
|
|||||||
static int rteth_open(struct net_device *dev)
|
static int rteth_open(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct rteth_ctrl *ctrl = netdev_priv(dev);
|
struct rteth_ctrl *ctrl = netdev_priv(dev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
pr_debug("%s called: RX rings %d(length %d), TX rings %d(length %d)\n",
|
pr_debug("%s called: RX rings %d(length %d), TX rings %d(length %d)\n",
|
||||||
__func__, RTETH_RX_RINGS, RTETH_RX_RING_SIZE, RTETH_TX_RINGS, RTETH_TX_RING_SIZE);
|
__func__, RTETH_RX_RINGS, RTETH_RX_RING_SIZE, RTETH_TX_RINGS, RTETH_TX_RING_SIZE);
|
||||||
@ -708,7 +711,10 @@ static int rteth_open(struct net_device *dev)
|
|||||||
scoped_guard(spinlock_irqsave, &ctrl->lock) {
|
scoped_guard(spinlock_irqsave, &ctrl->lock) {
|
||||||
ctrl->r->hw_reset(ctrl);
|
ctrl->r->hw_reset(ctrl);
|
||||||
rteth_setup_cpu_rx_rings(ctrl);
|
rteth_setup_cpu_rx_rings(ctrl);
|
||||||
rteth_setup_ring_buffer(ctrl);
|
ret = rteth_setup_ring_buffer(ctrl);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (ctrl->r->setup_notify_ring_buffer)
|
if (ctrl->r->setup_notify_ring_buffer)
|
||||||
ctrl->r->setup_notify_ring_buffer(ctrl);
|
ctrl->r->setup_notify_ring_buffer(ctrl);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user