Message ID | 20240918205258.444880-1-dave@treblig.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: Remove deadcode | expand |
On 18/09/2024 22.52, dave@treblig.org wrote: > From: "Dr. David Alan Gilbert" <dave@treblig.org> > > net_hub_port_find is unused since 2018's commit > af1a5c3eb4 ("net: Remove the deprecated "vlan" parameter") > > qemu_receive_packet_iov is unused since commit > ffbd2dbd8e ("e1000e: Perform software segmentation for loopback") > > in turn it was the last user of qemu_net_queue_receive_iov. > > Remove them. > > Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org> > --- > include/net/net.h | 4 ---- > include/net/queue.h | 4 ---- > net/hub.c | 25 ------------------------- > net/net.c | 10 ---------- > net/queue.c | 11 ----------- > 5 files changed, 54 deletions(-) > > diff --git a/include/net/net.h b/include/net/net.h > index c8f679761b..cdd5b109b0 100644 > --- a/include/net/net.h > +++ b/include/net/net.h > @@ -172,9 +172,6 @@ ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov, > int iovcnt, NetPacketSent *sent_cb); > ssize_t qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size); > ssize_t qemu_receive_packet(NetClientState *nc, const uint8_t *buf, int size); > -ssize_t qemu_receive_packet_iov(NetClientState *nc, > - const struct iovec *iov, > - int iovcnt); > ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size); > ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf, > int size, NetPacketSent *sent_cb); > @@ -307,7 +304,6 @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict); > void netdev_add(QemuOpts *opts, Error **errp); > > int net_hub_id_for_client(NetClientState *nc, int *id); > -NetClientState *net_hub_port_find(int hub_id); > > #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup" > #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown" > diff --git a/include/net/queue.h b/include/net/queue.h > index 9f2f289d77..2e686b1b61 100644 > --- a/include/net/queue.h > +++ b/include/net/queue.h > @@ -59,10 +59,6 @@ ssize_t qemu_net_queue_receive(NetQueue *queue, > const uint8_t *data, > size_t size); > > -ssize_t qemu_net_queue_receive_iov(NetQueue *queue, > - const struct iovec *iov, > - int iovcnt); > - > ssize_t qemu_net_queue_send(NetQueue *queue, > NetClientState *sender, > unsigned flags, > diff --git a/net/hub.c b/net/hub.c > index 4c8a469a50..496a3d3b4b 100644 > --- a/net/hub.c > +++ b/net/hub.c > @@ -193,31 +193,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name, > return &port->nc; > } > > -/** > - * Find a available port on a hub; otherwise create one new port > - */ > -NetClientState *net_hub_port_find(int hub_id) > -{ > - NetHub *hub; > - NetHubPort *port; > - NetClientState *nc; > - > - QLIST_FOREACH(hub, &hubs, next) { > - if (hub->id == hub_id) { > - QLIST_FOREACH(port, &hub->ports, next) { > - nc = port->nc.peer; > - if (!nc) { > - return &(port->nc); > - } > - } > - break; > - } > - } > - > - nc = net_hub_add_port(hub_id, NULL, NULL); > - return nc; > -} > - > /** > * Print hub configuration > */ > diff --git a/net/net.c b/net/net.c > index fc1125111c..d9b23a8f8c 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -750,16 +750,6 @@ ssize_t qemu_receive_packet(NetClientState *nc, const uint8_t *buf, int size) > return qemu_net_queue_receive(nc->incoming_queue, buf, size); > } > > -ssize_t qemu_receive_packet_iov(NetClientState *nc, const struct iovec *iov, > - int iovcnt) > -{ > - if (!qemu_can_receive_packet(nc)) { > - return 0; > - } > - > - return qemu_net_queue_receive_iov(nc->incoming_queue, iov, iovcnt); > -} > - > ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size) > { > return qemu_send_packet_async_with_flags(nc, QEMU_NET_PACKET_FLAG_RAW, > diff --git a/net/queue.c b/net/queue.c > index c872d51df8..fb33856c18 100644 > --- a/net/queue.c > +++ b/net/queue.c > @@ -193,17 +193,6 @@ ssize_t qemu_net_queue_receive(NetQueue *queue, > return qemu_net_queue_deliver(queue, NULL, 0, data, size); > } > > -ssize_t qemu_net_queue_receive_iov(NetQueue *queue, > - const struct iovec *iov, > - int iovcnt) > -{ > - if (queue->delivering) { > - return 0; > - } > - > - return qemu_net_queue_deliver_iov(queue, NULL, 0, iov, iovcnt); > -} > - > ssize_t qemu_net_queue_send(NetQueue *queue, > NetClientState *sender, > unsigned flags, Reviewed-by: Thomas Huth <thuth@redhat.com>
On Thu, Sep 19, 2024 at 4:53 AM <dave@treblig.org> wrote: > > From: "Dr. David Alan Gilbert" <dave@treblig.org> > > net_hub_port_find is unused since 2018's commit > af1a5c3eb4 ("net: Remove the deprecated "vlan" parameter") > > qemu_receive_packet_iov is unused since commit > ffbd2dbd8e ("e1000e: Perform software segmentation for loopback") > > in turn it was the last user of qemu_net_queue_receive_iov. > > Remove them. > > Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org> > --- Queued. Thanks
diff --git a/include/net/net.h b/include/net/net.h index c8f679761b..cdd5b109b0 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -172,9 +172,6 @@ ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov, int iovcnt, NetPacketSent *sent_cb); ssize_t qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size); ssize_t qemu_receive_packet(NetClientState *nc, const uint8_t *buf, int size); -ssize_t qemu_receive_packet_iov(NetClientState *nc, - const struct iovec *iov, - int iovcnt); ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size); ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf, int size, NetPacketSent *sent_cb); @@ -307,7 +304,6 @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict); void netdev_add(QemuOpts *opts, Error **errp); int net_hub_id_for_client(NetClientState *nc, int *id); -NetClientState *net_hub_port_find(int hub_id); #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown" diff --git a/include/net/queue.h b/include/net/queue.h index 9f2f289d77..2e686b1b61 100644 --- a/include/net/queue.h +++ b/include/net/queue.h @@ -59,10 +59,6 @@ ssize_t qemu_net_queue_receive(NetQueue *queue, const uint8_t *data, size_t size); -ssize_t qemu_net_queue_receive_iov(NetQueue *queue, - const struct iovec *iov, - int iovcnt); - ssize_t qemu_net_queue_send(NetQueue *queue, NetClientState *sender, unsigned flags, diff --git a/net/hub.c b/net/hub.c index 4c8a469a50..496a3d3b4b 100644 --- a/net/hub.c +++ b/net/hub.c @@ -193,31 +193,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name, return &port->nc; } -/** - * Find a available port on a hub; otherwise create one new port - */ -NetClientState *net_hub_port_find(int hub_id) -{ - NetHub *hub; - NetHubPort *port; - NetClientState *nc; - - QLIST_FOREACH(hub, &hubs, next) { - if (hub->id == hub_id) { - QLIST_FOREACH(port, &hub->ports, next) { - nc = port->nc.peer; - if (!nc) { - return &(port->nc); - } - } - break; - } - } - - nc = net_hub_add_port(hub_id, NULL, NULL); - return nc; -} - /** * Print hub configuration */ diff --git a/net/net.c b/net/net.c index fc1125111c..d9b23a8f8c 100644 --- a/net/net.c +++ b/net/net.c @@ -750,16 +750,6 @@ ssize_t qemu_receive_packet(NetClientState *nc, const uint8_t *buf, int size) return qemu_net_queue_receive(nc->incoming_queue, buf, size); } -ssize_t qemu_receive_packet_iov(NetClientState *nc, const struct iovec *iov, - int iovcnt) -{ - if (!qemu_can_receive_packet(nc)) { - return 0; - } - - return qemu_net_queue_receive_iov(nc->incoming_queue, iov, iovcnt); -} - ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size) { return qemu_send_packet_async_with_flags(nc, QEMU_NET_PACKET_FLAG_RAW, diff --git a/net/queue.c b/net/queue.c index c872d51df8..fb33856c18 100644 --- a/net/queue.c +++ b/net/queue.c @@ -193,17 +193,6 @@ ssize_t qemu_net_queue_receive(NetQueue *queue, return qemu_net_queue_deliver(queue, NULL, 0, data, size); } -ssize_t qemu_net_queue_receive_iov(NetQueue *queue, - const struct iovec *iov, - int iovcnt) -{ - if (queue->delivering) { - return 0; - } - - return qemu_net_queue_deliver_iov(queue, NULL, 0, iov, iovcnt); -} - ssize_t qemu_net_queue_send(NetQueue *queue, NetClientState *sender, unsigned flags,