From: Ben Pfaff Date: Tue, 5 May 2009 21:23:32 +0000 (-0700) Subject: datapath: Omit SNAT-specific data when SNAT is not enabled. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a946a6ed45402ffd9a29ea9d06ffb18ef660b76;p=openvswitch datapath: Omit SNAT-specific data when SNAT is not enabled. This saves a few bytes of memory but it also makes it clear to the reader what data is used for what. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 1c34f927..0fc4ad27 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -353,7 +353,9 @@ static int new_nbp(struct datapath *dp, struct net_device *dev, int port_no) dev_set_promiscuity(dev, 1); dev_hold(dev); p->port_no = port_no; +#ifdef SUPPORT_SNAT spin_lock_init(&p->lock); +#endif p->dp = dp; p->dev = dev; if (port_no != ODPP_LOCAL) diff --git a/datapath/datapath.h b/datapath/datapath.h index 30f6e5fc..416821b3 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -89,11 +89,13 @@ struct datapath { struct net_bridge_port { u16 port_no; - spinlock_t lock; struct datapath *dp; struct net_device *dev; struct kobject kobj; - struct snat_conf *snat; /* Only set if SNAT is configured for this port. */ +#ifdef SUPPORT_SNAT + spinlock_t lock; + struct snat_conf *snat; +#endif struct list_head node; /* Element in datapath.ports. */ };