Skip to contentSkip to conversation

kvm tools: Drop unused variable in struct uip_buf

PATCH New Asias He 1 participant 5 messages Oct 31, 2011 KVM

lore
Share & tools
lore

Asias He

author
#0 lore raw

PATCH 1/5 kvm tools: Drop unused variable in struct uip_buf

'u32 payload' is not used, so drop it.

---
 tools/kvm/include/kvm/uip.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
tools/kvm/include/kvm/uip.h +0 -1
index 3501d36..bded986 100644
@@ -209,7 +209,6 @@ struct uip_info {
 struct uip_buf {
 	struct list_head list;
 	struct uip_info *info;
-	u32 payload;
 	int vnet_len;
 	int eth_len;
 	int status;
Signature · 1 line
1.7.7.1
author
#1 lore raw

PATCH 2/5 kvm tools: Use macro in uip_tx_do_ipv4()

Use marcro instead of magic number in uip_tx_do_ipv4()

---
 tools/kvm/include/kvm/uip.h |    1 +
 tools/kvm/net/uip/ipv4.c    |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
tools/kvm/include/kvm/uip.h +1 -0
index bded986..4497f6a 100644
@@ -19,6 +19,7 @@
 #define UIP_IP_TTL		0X40
 #define UIP_IP_P_UDP		0X11
 #define UIP_IP_P_TCP		0X06
+#define UIP_IP_P_ICMP		0X01
 
 #define UIP_TCP_HDR_LEN		0x50
 #define UIP_TCP_WIN_SIZE	14600
tools/kvm/net/uip/ipv4.c +3 -3
index 4def129..58373fd 100644
@@ -12,13 +12,13 @@ int uip_tx_do_ipv4(struct uip_tx_arg *arg)
 	}
 
 	switch (ip->proto) {
-	case 0x01: /* ICMP */
+	case UIP_IP_P_ICMP:
 		uip_tx_do_ipv4_icmp(arg);
 		break;
-	case 0x06: /* TCP */
+	case UIP_IP_P_TCP:
 		uip_tx_do_ipv4_tcp(arg);
 		break;
-	case 0x11: /* UDP */
+	case UIP_IP_P_UDP:
 		uip_tx_do_ipv4_udp(arg);
 		break;
 	default:
Signature · 1 line
1.7.7.1
author
#2 lore raw

PATCH 3/5 kvm tools: Fix a vertical indentation for net/uip/udp.c

In reply to Asias He
---
 tools/kvm/net/uip/udp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kvm/net/uip/udp.c +1 -1
index 39c2b57..d4518b2 100644
@@ -182,7 +182,7 @@ static void *uip_udp_socket_thread(void *p)
 			/*
 			 * Get free buffer to send data to guest
 			 */
-			buf		= uip_buf_get_free(info);
+			buf = uip_buf_get_free(info);
 
 			uip_udp_make_pkg(info, sk, buf, payload, payload_len);
 
Signature · 1 line
1.7.7.1
author
#3 lore raw

PATCH 4/5 kvm tools: Fix ndev mutex and condition variable initialization

In reply to Asias He

This patch fixes the initialization of the following variables:

ndev->io_tx_lock
ndev->io_rx_lock
ndev->io_tx_cond
ndev->io_rx_cond

---
 tools/kvm/virtio/net.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
tools/kvm/virtio/net.c +3 -3
index 1b59972..7cd6794 100644
@@ -248,14 +248,14 @@ fail:
 
 static void virtio_net__io_thread_init(struct kvm *kvm, struct net_dev *ndev)
 {
+	pthread_mutex_init(&ndev->io_tx_lock, NULL);
 	pthread_mutex_init(&ndev->io_rx_lock, NULL);
-	pthread_cond_init(&ndev->io_tx_cond, NULL);
 
-	pthread_mutex_init(&ndev->io_rx_lock, NULL);
 	pthread_cond_init(&ndev->io_tx_cond, NULL);
+	pthread_cond_init(&ndev->io_rx_cond, NULL);
 
-	pthread_create(&ndev->io_rx_thread, NULL, virtio_net_rx_thread, ndev);
 	pthread_create(&ndev->io_tx_thread, NULL, virtio_net_tx_thread, ndev);
+	pthread_create(&ndev->io_rx_thread, NULL, virtio_net_rx_thread, ndev);
 }
 
 static inline int tap_ops_tx(struct iovec *iov, u16 out, struct net_dev *ndev)
Signature · 1 line
1.7.7.1
author
#4 lore raw

PATCH 5/5 kvm tools: Remove dead code virt_queue__trigger_irq()

In reply to Asias He

This function is not used anymore. Instead, We are using virtio_pci__signal_vq() to trigger interrupt right now.

---
 tools/kvm/include/kvm/virtio.h |    3 ---
 tools/kvm/virtio/core.c        |   12 ------------
 2 files changed, 0 insertions(+), 15 deletions(-)
tools/kvm/include/kvm/virtio.h +0 -3
index 3442338..c6c380d 100644
@@ -57,9 +57,6 @@ u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out,
 u16 virt_queue__get_inout_iov(struct kvm *kvm, struct virt_queue *queue,
 			      struct iovec in_iov[], struct iovec out_iov[],
 			      u16 *in, u16 *out);
-
-void virt_queue__trigger_irq(struct virt_queue *vq, int irq, u8 *isr, struct kvm *kvm);
-
 int virtio__get_dev_specific_field(int offset, bool msix, bool features_hi, u32 *config_off);
 
 #endif /* KVM__VIRTIO_H */
tools/kvm/virtio/core.c +0 -12
index d7c132b..0466e07 100644
@@ -89,18 +89,6 @@ u16 virt_queue__get_inout_iov(struct kvm *kvm, struct virt_queue *queue,
 	return head;
 }
 
-
-void virt_queue__trigger_irq(struct virt_queue *vq, int irq, u8 *isr, struct kvm *kvm)
-{
-	if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
-		return;
-
-	if (*isr == VIRTIO_IRQ_LOW) {
-		*isr = VIRTIO_IRQ_HIGH;
-		kvm__irq_line(kvm, irq, VIRTIO_IRQ_HIGH);
-	}
-}
-
 int virtio__get_dev_specific_field(int offset, bool msix, bool features_hi, u32 *config_off)
 {
 	if (msix) {
Signature · 1 line
1.7.7.1