diff options
author | Joe Perches <joe@perches.com> | 2010-01-26 06:40:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-27 00:16:01 -0500 |
commit | bee67d34b2dd495feafb1a37b5ea2d6179b74178 (patch) | |
tree | 52e4d5888eef06807b090ccebdd1f71846fcd8dd /net/atm/mpoa_caches.c | |
parent | 5710044073ea734c0d7806d7fb9cd6308053704b (diff) |
net/atm/mpoa_caches.c: checkpatch cleanups
Convert #include <asm... to #include <linux...
Add printk argument verification to dprintk and ddprintk
Spacing cleanups
Mostly 80 column wrapped.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/mpoa_caches.c')
-rw-r--r-- | net/atm/mpoa_caches.c | 160 |
1 files changed, 88 insertions, 72 deletions
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 4504a4b339bb..de21cc66feb4 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c | |||
@@ -11,15 +11,17 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #if 0 | 13 | #if 0 |
14 | #define dprintk printk /* debug */ | 14 | #define dprintk(format, args...) printk(KERN_DEBUG format, ##args) /* debug */ |
15 | #else | 15 | #else |
16 | #define dprintk(format,args...) | 16 | #define dprintk(format, args...) \ |
17 | do { if (0) printk(KERN_DEBUG format, ##args); } while (0) | ||
17 | #endif | 18 | #endif |
18 | 19 | ||
19 | #if 0 | 20 | #if 0 |
20 | #define ddprintk printk /* more debug */ | 21 | #define ddprintk printk(KERN_DEBUG format, ##args) /* more debug */ |
21 | #else | 22 | #else |
22 | #define ddprintk(format,args...) | 23 | #define ddprintk(format, args...) \ |
24 | do { if (0) printk(KERN_DEBUG format, ##args); } while (0) | ||
23 | #endif | 25 | #endif |
24 | 26 | ||
25 | static in_cache_entry *in_cache_get(__be32 dst_ip, | 27 | static in_cache_entry *in_cache_get(__be32 dst_ip, |
@@ -29,8 +31,8 @@ static in_cache_entry *in_cache_get(__be32 dst_ip, | |||
29 | 31 | ||
30 | read_lock_bh(&client->ingress_lock); | 32 | read_lock_bh(&client->ingress_lock); |
31 | entry = client->in_cache; | 33 | entry = client->in_cache; |
32 | while(entry != NULL){ | 34 | while (entry != NULL) { |
33 | if( entry->ctrl_info.in_dst_ip == dst_ip ){ | 35 | if (entry->ctrl_info.in_dst_ip == dst_ip) { |
34 | atomic_inc(&entry->use); | 36 | atomic_inc(&entry->use); |
35 | read_unlock_bh(&client->ingress_lock); | 37 | read_unlock_bh(&client->ingress_lock); |
36 | return entry; | 38 | return entry; |
@@ -50,8 +52,8 @@ static in_cache_entry *in_cache_get_with_mask(__be32 dst_ip, | |||
50 | 52 | ||
51 | read_lock_bh(&client->ingress_lock); | 53 | read_lock_bh(&client->ingress_lock); |
52 | entry = client->in_cache; | 54 | entry = client->in_cache; |
53 | while(entry != NULL){ | 55 | while (entry != NULL) { |
54 | if((entry->ctrl_info.in_dst_ip & mask) == (dst_ip & mask )){ | 56 | if ((entry->ctrl_info.in_dst_ip & mask) == (dst_ip & mask)) { |
55 | atomic_inc(&entry->use); | 57 | atomic_inc(&entry->use); |
56 | read_unlock_bh(&client->ingress_lock); | 58 | read_unlock_bh(&client->ingress_lock); |
57 | return entry; | 59 | return entry; |
@@ -65,14 +67,14 @@ static in_cache_entry *in_cache_get_with_mask(__be32 dst_ip, | |||
65 | } | 67 | } |
66 | 68 | ||
67 | static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc, | 69 | static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc, |
68 | struct mpoa_client *client ) | 70 | struct mpoa_client *client) |
69 | { | 71 | { |
70 | in_cache_entry *entry; | 72 | in_cache_entry *entry; |
71 | 73 | ||
72 | read_lock_bh(&client->ingress_lock); | 74 | read_lock_bh(&client->ingress_lock); |
73 | entry = client->in_cache; | 75 | entry = client->in_cache; |
74 | while(entry != NULL){ | 76 | while (entry != NULL) { |
75 | if(entry->shortcut == vcc) { | 77 | if (entry->shortcut == vcc) { |
76 | atomic_inc(&entry->use); | 78 | atomic_inc(&entry->use); |
77 | read_unlock_bh(&client->ingress_lock); | 79 | read_unlock_bh(&client->ingress_lock); |
78 | return entry; | 80 | return entry; |
@@ -90,11 +92,12 @@ static in_cache_entry *in_cache_add_entry(__be32 dst_ip, | |||
90 | in_cache_entry *entry = kzalloc(sizeof(in_cache_entry), GFP_KERNEL); | 92 | in_cache_entry *entry = kzalloc(sizeof(in_cache_entry), GFP_KERNEL); |
91 | 93 | ||
92 | if (entry == NULL) { | 94 | if (entry == NULL) { |
93 | printk("mpoa: mpoa_caches.c: new_in_cache_entry: out of memory\n"); | 95 | pr_info("mpoa: mpoa_caches.c: new_in_cache_entry: out of memory\n"); |
94 | return NULL; | 96 | return NULL; |
95 | } | 97 | } |
96 | 98 | ||
97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %pI4\n", &dst_ip); | 99 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %pI4\n", |
100 | &dst_ip); | ||
98 | 101 | ||
99 | atomic_set(&entry->use, 1); | 102 | atomic_set(&entry->use, 1); |
100 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); | 103 | dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n"); |
@@ -126,39 +129,41 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) | |||
126 | struct k_message msg; | 129 | struct k_message msg; |
127 | 130 | ||
128 | entry->count++; | 131 | entry->count++; |
129 | if(entry->entry_state == INGRESS_RESOLVED && entry->shortcut != NULL) | 132 | if (entry->entry_state == INGRESS_RESOLVED && entry->shortcut != NULL) |
130 | return OPEN; | 133 | return OPEN; |
131 | 134 | ||
132 | if(entry->entry_state == INGRESS_REFRESHING){ | 135 | if (entry->entry_state == INGRESS_REFRESHING) { |
133 | if(entry->count > mpc->parameters.mpc_p1){ | 136 | if (entry->count > mpc->parameters.mpc_p1) { |
134 | msg.type = SND_MPOA_RES_RQST; | 137 | msg.type = SND_MPOA_RES_RQST; |
135 | msg.content.in_info = entry->ctrl_info; | 138 | msg.content.in_info = entry->ctrl_info; |
136 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN); | 139 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN); |
137 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); | 140 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); |
138 | if (qos != NULL) msg.qos = qos->qos; | 141 | if (qos != NULL) |
142 | msg.qos = qos->qos; | ||
139 | msg_to_mpoad(&msg, mpc); | 143 | msg_to_mpoad(&msg, mpc); |
140 | do_gettimeofday(&(entry->reply_wait)); | 144 | do_gettimeofday(&(entry->reply_wait)); |
141 | entry->entry_state = INGRESS_RESOLVING; | 145 | entry->entry_state = INGRESS_RESOLVING; |
142 | } | 146 | } |
143 | if(entry->shortcut != NULL) | 147 | if (entry->shortcut != NULL) |
144 | return OPEN; | 148 | return OPEN; |
145 | return CLOSED; | 149 | return CLOSED; |
146 | } | 150 | } |
147 | 151 | ||
148 | if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL) | 152 | if (entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL) |
149 | return OPEN; | 153 | return OPEN; |
150 | 154 | ||
151 | if( entry->count > mpc->parameters.mpc_p1 && | 155 | if (entry->count > mpc->parameters.mpc_p1 && |
152 | entry->entry_state == INGRESS_INVALID){ | 156 | entry->entry_state == INGRESS_INVALID) { |
153 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %pI4, sending MPOA res req\n", | 157 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %pI4, sending MPOA res req\n", |
154 | mpc->dev->name, &entry->ctrl_info.in_dst_ip); | 158 | mpc->dev->name, &entry->ctrl_info.in_dst_ip); |
155 | entry->entry_state = INGRESS_RESOLVING; | 159 | entry->entry_state = INGRESS_RESOLVING; |
156 | msg.type = SND_MPOA_RES_RQST; | 160 | msg.type = SND_MPOA_RES_RQST; |
157 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); | 161 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN); |
158 | msg.content.in_info = entry->ctrl_info; | 162 | msg.content.in_info = entry->ctrl_info; |
159 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); | 163 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); |
160 | if (qos != NULL) msg.qos = qos->qos; | 164 | if (qos != NULL) |
161 | msg_to_mpoad( &msg, mpc); | 165 | msg.qos = qos->qos; |
166 | msg_to_mpoad(&msg, mpc); | ||
162 | do_gettimeofday(&(entry->reply_wait)); | 167 | do_gettimeofday(&(entry->reply_wait)); |
163 | } | 168 | } |
164 | 169 | ||
@@ -195,14 +200,15 @@ static void in_cache_remove_entry(in_cache_entry *entry, | |||
195 | if (entry->next != NULL) | 200 | if (entry->next != NULL) |
196 | entry->next->prev = entry->prev; | 201 | entry->next->prev = entry->prev; |
197 | client->in_ops->put(entry); | 202 | client->in_ops->put(entry); |
198 | if(client->in_cache == NULL && client->eg_cache == NULL){ | 203 | if (client->in_cache == NULL && client->eg_cache == NULL) { |
199 | msg.type = STOP_KEEP_ALIVE_SM; | 204 | msg.type = STOP_KEEP_ALIVE_SM; |
200 | msg_to_mpoad(&msg,client); | 205 | msg_to_mpoad(&msg, client); |
201 | } | 206 | } |
202 | 207 | ||
203 | /* Check if the egress side still uses this VCC */ | 208 | /* Check if the egress side still uses this VCC */ |
204 | if (vcc != NULL) { | 209 | if (vcc != NULL) { |
205 | eg_cache_entry *eg_entry = client->eg_ops->get_by_vcc(vcc, client); | 210 | eg_cache_entry *eg_entry = client->eg_ops->get_by_vcc(vcc, |
211 | client); | ||
206 | if (eg_entry != NULL) { | 212 | if (eg_entry != NULL) { |
207 | client->eg_ops->put(eg_entry); | 213 | client->eg_ops->put(eg_entry); |
208 | return; | 214 | return; |
@@ -213,7 +219,6 @@ static void in_cache_remove_entry(in_cache_entry *entry, | |||
213 | return; | 219 | return; |
214 | } | 220 | } |
215 | 221 | ||
216 | |||
217 | /* Call this every MPC-p2 seconds... Not exactly correct solution, | 222 | /* Call this every MPC-p2 seconds... Not exactly correct solution, |
218 | but an easy one... */ | 223 | but an easy one... */ |
219 | static void clear_count_and_expired(struct mpoa_client *client) | 224 | static void clear_count_and_expired(struct mpoa_client *client) |
@@ -225,11 +230,11 @@ static void clear_count_and_expired(struct mpoa_client *client) | |||
225 | 230 | ||
226 | write_lock_bh(&client->ingress_lock); | 231 | write_lock_bh(&client->ingress_lock); |
227 | entry = client->in_cache; | 232 | entry = client->in_cache; |
228 | while(entry != NULL){ | 233 | while (entry != NULL) { |
229 | entry->count=0; | 234 | entry->count = 0; |
230 | next_entry = entry->next; | 235 | next_entry = entry->next; |
231 | if((now.tv_sec - entry->tv.tv_sec) | 236 | if ((now.tv_sec - entry->tv.tv_sec) |
232 | > entry->ctrl_info.holding_time){ | 237 | > entry->ctrl_info.holding_time) { |
233 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %pI4\n", | 238 | dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %pI4\n", |
234 | &entry->ctrl_info.in_dst_ip); | 239 | &entry->ctrl_info.in_dst_ip); |
235 | client->in_ops->remove_entry(entry, client); | 240 | client->in_ops->remove_entry(entry, client); |
@@ -250,33 +255,38 @@ static void check_resolving_entries(struct mpoa_client *client) | |||
250 | struct timeval now; | 255 | struct timeval now; |
251 | struct k_message msg; | 256 | struct k_message msg; |
252 | 257 | ||
253 | do_gettimeofday( &now ); | 258 | do_gettimeofday(&now); |
254 | 259 | ||
255 | read_lock_bh(&client->ingress_lock); | 260 | read_lock_bh(&client->ingress_lock); |
256 | entry = client->in_cache; | 261 | entry = client->in_cache; |
257 | while( entry != NULL ){ | 262 | while (entry != NULL) { |
258 | if(entry->entry_state == INGRESS_RESOLVING){ | 263 | if (entry->entry_state == INGRESS_RESOLVING) { |
259 | if(now.tv_sec - entry->hold_down.tv_sec < client->parameters.mpc_p6){ | 264 | if ((now.tv_sec - entry->hold_down.tv_sec) < |
260 | entry = entry->next; /* Entry in hold down */ | 265 | client->parameters.mpc_p6) { |
266 | entry = entry->next; /* Entry in hold down */ | ||
261 | continue; | 267 | continue; |
262 | } | 268 | } |
263 | if( (now.tv_sec - entry->reply_wait.tv_sec) > | 269 | if ((now.tv_sec - entry->reply_wait.tv_sec) > |
264 | entry->retry_time ){ | 270 | entry->retry_time) { |
265 | entry->retry_time = MPC_C1*( entry->retry_time ); | 271 | entry->retry_time = MPC_C1 * (entry->retry_time); |
266 | if(entry->retry_time > client->parameters.mpc_p5){ | 272 | /* |
267 | /* Retry time maximum exceeded, put entry in hold down. */ | 273 | * Retry time maximum exceeded, |
274 | * put entry in hold down. | ||
275 | */ | ||
276 | if (entry->retry_time > client->parameters.mpc_p5) { | ||
268 | do_gettimeofday(&(entry->hold_down)); | 277 | do_gettimeofday(&(entry->hold_down)); |
269 | entry->retry_time = client->parameters.mpc_p4; | 278 | entry->retry_time = client->parameters.mpc_p4; |
270 | entry = entry->next; | 279 | entry = entry->next; |
271 | continue; | 280 | continue; |
272 | } | 281 | } |
273 | /* Ask daemon to send a resolution request. */ | 282 | /* Ask daemon to send a resolution request. */ |
274 | memset(&(entry->hold_down),0,sizeof(struct timeval)); | 283 | memset(&(entry->hold_down), 0, sizeof(struct timeval)); |
275 | msg.type = SND_MPOA_RES_RTRY; | 284 | msg.type = SND_MPOA_RES_RTRY; |
276 | memcpy(msg.MPS_ctrl, client->mps_ctrl_addr, ATM_ESA_LEN); | 285 | memcpy(msg.MPS_ctrl, client->mps_ctrl_addr, ATM_ESA_LEN); |
277 | msg.content.in_info = entry->ctrl_info; | 286 | msg.content.in_info = entry->ctrl_info; |
278 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); | 287 | qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); |
279 | if (qos != NULL) msg.qos = qos->qos; | 288 | if (qos != NULL) |
289 | msg.qos = qos->qos; | ||
280 | msg_to_mpoad(&msg, client); | 290 | msg_to_mpoad(&msg, client); |
281 | do_gettimeofday(&(entry->reply_wait)); | 291 | do_gettimeofday(&(entry->reply_wait)); |
282 | } | 292 | } |
@@ -296,11 +306,12 @@ static void refresh_entries(struct mpoa_client *client) | |||
296 | do_gettimeofday(&now); | 306 | do_gettimeofday(&now); |
297 | 307 | ||
298 | read_lock_bh(&client->ingress_lock); | 308 | read_lock_bh(&client->ingress_lock); |
299 | while( entry != NULL ){ | 309 | while (entry != NULL) { |
300 | if( entry->entry_state == INGRESS_RESOLVED ){ | 310 | if (entry->entry_state == INGRESS_RESOLVED) { |
301 | if(!(entry->refresh_time)) | 311 | if (!(entry->refresh_time)) |
302 | entry->refresh_time = (2*(entry->ctrl_info.holding_time))/3; | 312 | entry->refresh_time = (2 * (entry->ctrl_info.holding_time))/3; |
303 | if( (now.tv_sec - entry->reply_wait.tv_sec) > entry->refresh_time ){ | 313 | if ((now.tv_sec - entry->reply_wait.tv_sec) > |
314 | entry->refresh_time) { | ||
304 | dprintk("mpoa: mpoa_caches.c: refreshing an entry.\n"); | 315 | dprintk("mpoa: mpoa_caches.c: refreshing an entry.\n"); |
305 | entry->entry_state = INGRESS_REFRESHING; | 316 | entry->entry_state = INGRESS_REFRESHING; |
306 | 317 | ||
@@ -314,21 +325,22 @@ static void refresh_entries(struct mpoa_client *client) | |||
314 | static void in_destroy_cache(struct mpoa_client *mpc) | 325 | static void in_destroy_cache(struct mpoa_client *mpc) |
315 | { | 326 | { |
316 | write_lock_irq(&mpc->ingress_lock); | 327 | write_lock_irq(&mpc->ingress_lock); |
317 | while(mpc->in_cache != NULL) | 328 | while (mpc->in_cache != NULL) |
318 | mpc->in_ops->remove_entry(mpc->in_cache, mpc); | 329 | mpc->in_ops->remove_entry(mpc->in_cache, mpc); |
319 | write_unlock_irq(&mpc->ingress_lock); | 330 | write_unlock_irq(&mpc->ingress_lock); |
320 | 331 | ||
321 | return; | 332 | return; |
322 | } | 333 | } |
323 | 334 | ||
324 | static eg_cache_entry *eg_cache_get_by_cache_id(__be32 cache_id, struct mpoa_client *mpc) | 335 | static eg_cache_entry *eg_cache_get_by_cache_id(__be32 cache_id, |
336 | struct mpoa_client *mpc) | ||
325 | { | 337 | { |
326 | eg_cache_entry *entry; | 338 | eg_cache_entry *entry; |
327 | 339 | ||
328 | read_lock_irq(&mpc->egress_lock); | 340 | read_lock_irq(&mpc->egress_lock); |
329 | entry = mpc->eg_cache; | 341 | entry = mpc->eg_cache; |
330 | while(entry != NULL){ | 342 | while (entry != NULL) { |
331 | if(entry->ctrl_info.cache_id == cache_id){ | 343 | if (entry->ctrl_info.cache_id == cache_id) { |
332 | atomic_inc(&entry->use); | 344 | atomic_inc(&entry->use); |
333 | read_unlock_irq(&mpc->egress_lock); | 345 | read_unlock_irq(&mpc->egress_lock); |
334 | return entry; | 346 | return entry; |
@@ -348,7 +360,7 @@ static eg_cache_entry *eg_cache_get_by_tag(__be32 tag, struct mpoa_client *mpc) | |||
348 | 360 | ||
349 | read_lock_irqsave(&mpc->egress_lock, flags); | 361 | read_lock_irqsave(&mpc->egress_lock, flags); |
350 | entry = mpc->eg_cache; | 362 | entry = mpc->eg_cache; |
351 | while (entry != NULL){ | 363 | while (entry != NULL) { |
352 | if (entry->ctrl_info.tag == tag) { | 364 | if (entry->ctrl_info.tag == tag) { |
353 | atomic_inc(&entry->use); | 365 | atomic_inc(&entry->use); |
354 | read_unlock_irqrestore(&mpc->egress_lock, flags); | 366 | read_unlock_irqrestore(&mpc->egress_lock, flags); |
@@ -362,14 +374,15 @@ static eg_cache_entry *eg_cache_get_by_tag(__be32 tag, struct mpoa_client *mpc) | |||
362 | } | 374 | } |
363 | 375 | ||
364 | /* This can be called from any context since it saves CPU flags */ | 376 | /* This can be called from any context since it saves CPU flags */ |
365 | static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_client *mpc) | 377 | static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, |
378 | struct mpoa_client *mpc) | ||
366 | { | 379 | { |
367 | unsigned long flags; | 380 | unsigned long flags; |
368 | eg_cache_entry *entry; | 381 | eg_cache_entry *entry; |
369 | 382 | ||
370 | read_lock_irqsave(&mpc->egress_lock, flags); | 383 | read_lock_irqsave(&mpc->egress_lock, flags); |
371 | entry = mpc->eg_cache; | 384 | entry = mpc->eg_cache; |
372 | while (entry != NULL){ | 385 | while (entry != NULL) { |
373 | if (entry->shortcut == vcc) { | 386 | if (entry->shortcut == vcc) { |
374 | atomic_inc(&entry->use); | 387 | atomic_inc(&entry->use); |
375 | read_unlock_irqrestore(&mpc->egress_lock, flags); | 388 | read_unlock_irqrestore(&mpc->egress_lock, flags); |
@@ -382,14 +395,15 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie | |||
382 | return NULL; | 395 | return NULL; |
383 | } | 396 | } |
384 | 397 | ||
385 | static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client *mpc) | 398 | static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, |
399 | struct mpoa_client *mpc) | ||
386 | { | 400 | { |
387 | eg_cache_entry *entry; | 401 | eg_cache_entry *entry; |
388 | 402 | ||
389 | read_lock_irq(&mpc->egress_lock); | 403 | read_lock_irq(&mpc->egress_lock); |
390 | entry = mpc->eg_cache; | 404 | entry = mpc->eg_cache; |
391 | while(entry != NULL){ | 405 | while (entry != NULL) { |
392 | if(entry->latest_ip_addr == ipaddr) { | 406 | if (entry->latest_ip_addr == ipaddr) { |
393 | atomic_inc(&entry->use); | 407 | atomic_inc(&entry->use); |
394 | read_unlock_irq(&mpc->egress_lock); | 408 | read_unlock_irq(&mpc->egress_lock); |
395 | return entry; | 409 | return entry; |
@@ -429,9 +443,9 @@ static void eg_cache_remove_entry(eg_cache_entry *entry, | |||
429 | if (entry->next != NULL) | 443 | if (entry->next != NULL) |
430 | entry->next->prev = entry->prev; | 444 | entry->next->prev = entry->prev; |
431 | client->eg_ops->put(entry); | 445 | client->eg_ops->put(entry); |
432 | if(client->in_cache == NULL && client->eg_cache == NULL){ | 446 | if (client->in_cache == NULL && client->eg_cache == NULL) { |
433 | msg.type = STOP_KEEP_ALIVE_SM; | 447 | msg.type = STOP_KEEP_ALIVE_SM; |
434 | msg_to_mpoad(&msg,client); | 448 | msg_to_mpoad(&msg, client); |
435 | } | 449 | } |
436 | 450 | ||
437 | /* Check if the ingress side still uses this VCC */ | 451 | /* Check if the ingress side still uses this VCC */ |
@@ -447,12 +461,13 @@ static void eg_cache_remove_entry(eg_cache_entry *entry, | |||
447 | return; | 461 | return; |
448 | } | 462 | } |
449 | 463 | ||
450 | static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client) | 464 | static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, |
465 | struct mpoa_client *client) | ||
451 | { | 466 | { |
452 | eg_cache_entry *entry = kzalloc(sizeof(eg_cache_entry), GFP_KERNEL); | 467 | eg_cache_entry *entry = kzalloc(sizeof(eg_cache_entry), GFP_KERNEL); |
453 | 468 | ||
454 | if (entry == NULL) { | 469 | if (entry == NULL) { |
455 | printk("mpoa: mpoa_caches.c: new_eg_cache_entry: out of memory\n"); | 470 | pr_info("out of memory\n"); |
456 | return NULL; | 471 | return NULL; |
457 | } | 472 | } |
458 | 473 | ||
@@ -472,7 +487,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
472 | entry->ctrl_info = msg->content.eg_info; | 487 | entry->ctrl_info = msg->content.eg_info; |
473 | do_gettimeofday(&(entry->tv)); | 488 | do_gettimeofday(&(entry->tv)); |
474 | entry->entry_state = EGRESS_RESOLVED; | 489 | entry->entry_state = EGRESS_RESOLVED; |
475 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); | 490 | dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %u\n", |
491 | ntohl(entry->ctrl_info.cache_id)); | ||
476 | dprintk("mpoa: mpoa_caches.c: mps_ip = %pI4\n", | 492 | dprintk("mpoa: mpoa_caches.c: mps_ip = %pI4\n", |
477 | &entry->ctrl_info.mps_ip); | 493 | &entry->ctrl_info.mps_ip); |
478 | atomic_inc(&entry->use); | 494 | atomic_inc(&entry->use); |
@@ -483,7 +499,7 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli | |||
483 | return entry; | 499 | return entry; |
484 | } | 500 | } |
485 | 501 | ||
486 | static void update_eg_cache_entry(eg_cache_entry * entry, uint16_t holding_time) | 502 | static void update_eg_cache_entry(eg_cache_entry *entry, uint16_t holding_time) |
487 | { | 503 | { |
488 | do_gettimeofday(&(entry->tv)); | 504 | do_gettimeofday(&(entry->tv)); |
489 | entry->entry_state = EGRESS_RESOLVED; | 505 | entry->entry_state = EGRESS_RESOLVED; |
@@ -502,13 +518,14 @@ static void clear_expired(struct mpoa_client *client) | |||
502 | 518 | ||
503 | write_lock_irq(&client->egress_lock); | 519 | write_lock_irq(&client->egress_lock); |
504 | entry = client->eg_cache; | 520 | entry = client->eg_cache; |
505 | while(entry != NULL){ | 521 | while (entry != NULL) { |
506 | next_entry = entry->next; | 522 | next_entry = entry->next; |
507 | if((now.tv_sec - entry->tv.tv_sec) | 523 | if ((now.tv_sec - entry->tv.tv_sec) |
508 | > entry->ctrl_info.holding_time){ | 524 | > entry->ctrl_info.holding_time) { |
509 | msg.type = SND_EGRESS_PURGE; | 525 | msg.type = SND_EGRESS_PURGE; |
510 | msg.content.eg_info = entry->ctrl_info; | 526 | msg.content.eg_info = entry->ctrl_info; |
511 | dprintk("mpoa: mpoa_caches.c: egress_cache: holding time expired, cache_id = %lu.\n",ntohl(entry->ctrl_info.cache_id)); | 527 | dprintk("mpoa: mpoa_caches.c: egress_cache: holding time expired, cache_id = %u.\n", |
528 | ntohl(entry->ctrl_info.cache_id)); | ||
512 | msg_to_mpoad(&msg, client); | 529 | msg_to_mpoad(&msg, client); |
513 | client->eg_ops->remove_entry(entry, client); | 530 | client->eg_ops->remove_entry(entry, client); |
514 | } | 531 | } |
@@ -522,7 +539,7 @@ static void clear_expired(struct mpoa_client *client) | |||
522 | static void eg_destroy_cache(struct mpoa_client *mpc) | 539 | static void eg_destroy_cache(struct mpoa_client *mpc) |
523 | { | 540 | { |
524 | write_lock_irq(&mpc->egress_lock); | 541 | write_lock_irq(&mpc->egress_lock); |
525 | while(mpc->eg_cache != NULL) | 542 | while (mpc->eg_cache != NULL) |
526 | mpc->eg_ops->remove_entry(mpc->eg_cache, mpc); | 543 | mpc->eg_ops->remove_entry(mpc->eg_cache, mpc); |
527 | write_unlock_irq(&mpc->egress_lock); | 544 | write_unlock_irq(&mpc->egress_lock); |
528 | 545 | ||
@@ -530,7 +547,6 @@ static void eg_destroy_cache(struct mpoa_client *mpc) | |||
530 | } | 547 | } |
531 | 548 | ||
532 | 549 | ||
533 | |||
534 | static struct in_cache_ops ingress_ops = { | 550 | static struct in_cache_ops ingress_ops = { |
535 | in_cache_add_entry, /* add_entry */ | 551 | in_cache_add_entry, /* add_entry */ |
536 | in_cache_get, /* get */ | 552 | in_cache_get, /* get */ |