All of lore.kernel.org
 help / color / mirror / Atom feed
From: Asias He <asias.hejun@gmail.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Sasha Levin <levinsasha928@gmail.com>,
	kvm@vger.kernel.org, Asias He <asias.hejun@gmail.com>
Subject: [PATCH 2/5] kvm tools: Use macro in uip_tx_do_ipv4()
Date: Mon, 31 Oct 2011 22:39:39 +0800	[thread overview]
Message-ID: <1320071982-21560-2-git-send-email-asias.hejun@gmail.com> (raw)
In-Reply-To: <1320071982-21560-1-git-send-email-asias.hejun@gmail.com>

Use marcro instead of magic number in uip_tx_do_ipv4()

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 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


  reply	other threads:[~2011-10-31 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 14:39 [PATCH 1/5] kvm tools: Drop unused variable in struct uip_buf Asias He
2011-10-31 14:39 ` Asias He [this message]
2011-10-31 14:39 ` [PATCH 3/5] kvm tools: Fix a vertical indentation for net/uip/udp.c Asias He
2011-10-31 14:39 ` [PATCH 4/5] kvm tools: Fix ndev mutex and condition variable initialization Asias He
2011-10-31 14:39 ` [PATCH 5/5] kvm tools: Remove dead code virt_queue__trigger_irq() Asias He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320071982-21560-2-git-send-email-asias.hejun@gmail.com \
    --to=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.