Commit b4229934 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[ATM]: use NIPQUAD instead of open-coding it

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ac0760a
...@@ -560,7 +560,6 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) ...@@ -560,7 +560,6 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
struct atmmpc_ioc ioc_data; struct atmmpc_ioc ioc_data;
in_cache_entry *in_entry; in_cache_entry *in_entry;
uint32_t ipaddr; uint32_t ipaddr;
unsigned char *ip;
bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
if (bytes_left != 0) { if (bytes_left != 0) {
...@@ -583,9 +582,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) ...@@ -583,9 +582,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
if (in_entry != NULL) mpc->in_ops->put(in_entry); if (in_entry != NULL) mpc->in_ops->put(in_entry);
return -EINVAL; return -EINVAL;
} }
ip = (unsigned char*)&in_entry->ctrl_info.in_dst_ip;
printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n",
mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
in_entry->shortcut = vcc; in_entry->shortcut = vcc;
mpc->in_ops->put(in_entry); mpc->in_ops->put(in_entry);
} else { } else {
...@@ -616,10 +614,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) ...@@ -616,10 +614,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name);
in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); in_entry = mpc->in_ops->get_by_vcc(vcc, mpc);
if (in_entry) { if (in_entry) {
unsigned char *ip __attribute__ ((unused)) =
(unsigned char *)&in_entry->ctrl_info.in_dst_ip;
dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n",
mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
in_entry->shortcut = NULL; in_entry->shortcut = NULL;
mpc->in_ops->put(in_entry); mpc->in_ops->put(in_entry);
} }
...@@ -1154,18 +1150,17 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) ...@@ -1154,18 +1150,17 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{ {
uint32_t dst_ip = msg->content.in_info.in_dst_ip; uint32_t dst_ip = msg->content.in_info.in_dst_ip;
uint32_t mask = msg->ip_mask; uint32_t mask = msg->ip_mask;
unsigned char *ip = (unsigned char *)&dst_ip;
in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask);
if(entry == NULL){ if(entry == NULL){
printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name);
printk("ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]); printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
return; return;
} }
do { do {
dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" ,
mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); mpc->dev->name, NIPQUAD(dst_ip));
write_lock_bh(&mpc->ingress_lock); write_lock_bh(&mpc->ingress_lock);
mpc->in_ops->remove_entry(entry, mpc); mpc->in_ops->remove_entry(entry, mpc);
write_unlock_bh(&mpc->ingress_lock); write_unlock_bh(&mpc->ingress_lock);
......
...@@ -87,7 +87,6 @@ static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc, ...@@ -87,7 +87,6 @@ static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc,
static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, static in_cache_entry *in_cache_add_entry(uint32_t dst_ip,
struct mpoa_client *client) struct mpoa_client *client)
{ {
unsigned char *ip __attribute__ ((unused)) = (unsigned char *)&dst_ip;
in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL); in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL);
if (entry == NULL) { if (entry == NULL) {
...@@ -95,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, ...@@ -95,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(uint32_t dst_ip,
return NULL; return NULL;
} }
dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]); dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
memset(entry,0,sizeof(in_cache_entry)); memset(entry,0,sizeof(in_cache_entry));
atomic_set(&entry->use, 1); atomic_set(&entry->use, 1);
...@@ -152,10 +151,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) ...@@ -152,10 +151,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)
if( entry->count > mpc->parameters.mpc_p1 && if( entry->count > mpc->parameters.mpc_p1 &&
entry->entry_state == INGRESS_INVALID){ entry->entry_state == INGRESS_INVALID){
unsigned char *ip __attribute__ ((unused)) = dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip));
(unsigned char *)&entry->ctrl_info.in_dst_ip;
dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, ip[0], ip[1], ip[2], ip[3]);
entry->entry_state = INGRESS_RESOLVING; entry->entry_state = INGRESS_RESOLVING;
msg.type = SND_MPOA_RES_RQST; msg.type = SND_MPOA_RES_RQST;
memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN );
...@@ -187,11 +183,9 @@ static void in_cache_remove_entry(in_cache_entry *entry, ...@@ -187,11 +183,9 @@ static void in_cache_remove_entry(in_cache_entry *entry,
{ {
struct atm_vcc *vcc; struct atm_vcc *vcc;
struct k_message msg; struct k_message msg;
unsigned char *ip;
vcc = entry->shortcut; vcc = entry->shortcut;
ip = (unsigned char *)&entry->ctrl_info.in_dst_ip; dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip));
dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",ip[0], ip[1], ip[2], ip[3]);
if (entry->prev != NULL) if (entry->prev != NULL)
entry->prev->next = entry->next; entry->prev->next = entry->next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment