From mboxrd@z Thu Jan 1 00:00:00 1970 From: Asias He Subject: [PATCH 2/5] kvm tools: Use macro in uip_tx_do_ipv4() Date: Mon, 31 Oct 2011 22:39:39 +0800 Message-ID: <1320071982-21560-2-git-send-email-asias.hejun@gmail.com> References: <1320071982-21560-1-git-send-email-asias.hejun@gmail.com> Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , kvm@vger.kernel.org, Asias He To: Pekka Enberg Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:61867 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932642Ab1JaOku (ORCPT ); Mon, 31 Oct 2011 10:40:50 -0400 Received: by mail-iy0-f174.google.com with SMTP id y12so7240414iab.19 for ; Mon, 31 Oct 2011 07:40:50 -0700 (PDT) In-Reply-To: <1320071982-21560-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Use marcro instead of magic number in uip_tx_do_ipv4() Signed-off-by: Asias He --- 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