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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use marcro instead of magic number in uip_tx_do_ipv4()

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 tools/kvm/include/kvm/uip.h |    1 +
 tools/kvm/net/uip/ipv4.c    |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/include/kvm/uip.h b/tools/kvm/include/kvm/uip.h
index bded986..4497f6a 100644
--- a/tools/kvm/include/kvm/uip.h
+++ b/tools/kvm/include/kvm/uip.h
@@ -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
diff --git a/tools/kvm/net/uip/ipv4.c b/tools/kvm/net/uip/ipv4.c
index 4def129..58373fd 100644
--- a/tools/kvm/net/uip/ipv4.c
+++ b/tools/kvm/net/uip/ipv4.c
@@ -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:
-- 
1.7.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux