From 0a946a6ed45402ffd9a29ea9d06ffb18ef660b76 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 5 May 2009 14:23:32 -0700 Subject: [PATCH] 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. --- datapath/datapath.c | 2 ++ datapath/datapath.h | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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. */ }; -- 2.30.2