Skip to content

Commit 7073bb4

Browse files
committed
net: memzero mp params when closing a queue
Instead of resetting memory provider parameters one by one in __net_mp_{open,close}_rxq, memzero the entire structure. It'll be used to extend the structure. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
1 parent 0f61b18 commit 7073bb4

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

net/core/netdev_rx_queue.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx,
139139

140140
rxq->mp_params = *p;
141141
ret = netdev_rx_queue_restart(dev, rxq_idx);
142-
if (ret) {
143-
rxq->mp_params.mp_ops = NULL;
144-
rxq->mp_params.mp_priv = NULL;
145-
}
142+
if (ret)
143+
memset(&rxq->mp_params, 0, sizeof(rxq->mp_params));
144+
146145
return ret;
147146
}
148147

@@ -179,8 +178,7 @@ void __net_mp_close_rxq(struct net_device *dev, unsigned int ifq_idx,
179178
rxq->mp_params.mp_priv != old_p->mp_priv))
180179
return;
181180

182-
rxq->mp_params.mp_ops = NULL;
183-
rxq->mp_params.mp_priv = NULL;
181+
memset(&rxq->mp_params, 0, sizeof(rxq->mp_params));
184182
err = netdev_rx_queue_restart(dev, ifq_idx);
185183
WARN_ON(err && err != -ENETDOWN);
186184
}

0 commit comments

Comments
 (0)