[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517090836.533-8-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 17:08:26 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc: amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
kraxel@...hat.com, dan.j.williams@...el.com,
johannes@...solutions.net, ohad@...ery.com,
bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
miklos@...redi.hu, sgarzare@...hat.com,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 07/17] virtio_net: Remove unused used length
The used length is not used in some cases. Let's drop it
and pass NULL to virtqueue_get_buf() instead.
Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
drivers/net/virtio_net.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 5ca7d6780add..01e54e99cae6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -500,7 +500,6 @@ static int virtnet_xdp_xmit(struct net_device *dev,
struct receive_queue *rq = vi->rq;
struct bpf_prog *xdp_prog;
struct send_queue *sq;
- unsigned int len;
int packets = 0;
int bytes = 0;
int drops = 0;
@@ -525,7 +524,7 @@ static int virtnet_xdp_xmit(struct net_device *dev,
}
/* Free up any pending old buffers before queueing new ones. */
- while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) {
+ while ((ptr = virtqueue_get_buf(sq->vq, NULL)) != NULL) {
if (likely(is_xdp_frame(ptr))) {
struct xdp_frame *frame = ptr_to_xdp(ptr);
@@ -1378,12 +1377,11 @@ static int virtnet_receive(struct receive_queue *rq, int budget,
static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi)
{
- unsigned int len;
unsigned int packets = 0;
unsigned int bytes = 0;
void *ptr;
- while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) {
+ while ((ptr = virtqueue_get_buf(sq->vq, NULL)) != NULL) {
if (likely(!is_xdp_frame(ptr))) {
struct sk_buff *skb = ptr;
@@ -1681,7 +1679,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
struct scatterlist *out)
{
struct scatterlist *sgs[4], hdr, stat;
- unsigned out_num = 0, tmp;
+ unsigned out_num = 0;
/* Caller should know better */
BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ));
@@ -1709,7 +1707,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
/* Spin for a response, the kick causes an ioport write, trapping
* into the hypervisor, so the request should be handled immediately.
*/
- while (!virtqueue_get_buf(vi->cvq, &tmp) &&
+ while (!virtqueue_get_buf(vi->cvq, NULL) &&
!virtqueue_is_broken(vi->cvq))
cpu_relax();
--
2.11.0
Powered by blists - more mailing lists