* Re: Question regarding expected behavior of two udp sockets with SO_REUSEADDR set
From: Eric Dumazet @ 2010-11-20 15:38 UTC (permalink / raw)
To: Neil Horman; +Cc: netdev, davem
In-Reply-To: <20101120150441.GA17907@hmsreliant.think-freely.org>
Le samedi 20 novembre 2010 à 10:04 -0500, Neil Horman a écrit :
> https://bugzilla.redhat.com/show_bug.cgi?id=643911
I am not allowed to see this bug report.
' You are not authorized to access bug #643911 '
^ permalink raw reply
* Re: Question regarding expected behavior of two udp sockets with SO_REUSEADDR set
From: Eric Dumazet @ 2010-11-20 15:44 UTC (permalink / raw)
To: Neil Horman; +Cc: netdev, davem
In-Reply-To: <20101120150441.GA17907@hmsreliant.think-freely.org>
Le samedi 20 novembre 2010 à 10:04 -0500, Neil Horman a écrit :
> Agreed. My thought was to add logic to udp_lib_lport_inuse such that, if
> sk_reuse is set on both sockets, and the input snum is 0 (indicating autobind)
> we should not allow binding sk to inet_sk(sk2)->num. Thoughts?
I dont know, problem is this could be possible right now if sk2 is bound
on 127.0.0.2 address. Adding this test would reduce possible space.
Autobind is tricky, it chooses a port while address is part of the
problem.
Some loopback scalability problems could be solved if full range of
127.0.0.0/8 addresses were used, avoiding the dst refcount false
sharing :)
^ permalink raw reply
* Re: [PATCH] netfilter: remove an atomic bit operation
From: Tim Gardner @ 2010-11-20 16:03 UTC (permalink / raw)
To: Changli Gao; +Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev
In-Reply-To: <1290239717-12664-1-git-send-email-xiaosuo@gmail.com>
On 11/20/2010 12:55 AM, Changli Gao wrote:
> As this ct won't be seen by the others, we don't need to set the
> IPS_CONFIRMED_BIT in atomic way.
>
> Signed-off-by: Changli Gao<xiaosuo@gmail.com>
> ---
> net/netfilter/nf_conntrack_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 27a5ea6..c708248 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -486,7 +486,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
> ct->timeout.expires += jiffies;
> add_timer(&ct->timeout);
> atomic_inc(&ct->ct_general.use);
> - set_bit(IPS_CONFIRMED_BIT,&ct->status);
> + ct->status |= IPS_CONFIRMED_BIT;
>
> /* Since the lookup is lockless, hash insertion must be done after
> * starting the timer and setting the CONFIRMED bit. The RCU barriers
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
get away with a non-atomic operation on this field. I'll defer to
Patrick on that.
I think you have to use IPS_CONFIRMED instead, e.g.,
ct->status |= IPS_CONFIRMED;
rtg
--
Tim Gardner tim.gardner@canonical.com
^ permalink raw reply
* Re: [PATCH] netfilter: remove an atomic bit operation
From: Eric Dumazet @ 2010-11-20 16:50 UTC (permalink / raw)
To: tim.gardner
Cc: Changli Gao, Patrick McHardy, David S. Miller, netfilter-devel,
netdev
In-Reply-To: <4CE7F160.9050107@canonical.com>
Le samedi 20 novembre 2010 à 09:03 -0700, Tim Gardner a écrit :
> On 11/20/2010 12:55 AM, Changli Gao wrote:
> > As this ct won't be seen by the others, we don't need to set the
> > IPS_CONFIRMED_BIT in atomic way.
> >
> > Signed-off-by: Changli Gao<xiaosuo@gmail.com>
> > ---
> > net/netfilter/nf_conntrack_core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> > index 27a5ea6..c708248 100644
> > --- a/net/netfilter/nf_conntrack_core.c
> > +++ b/net/netfilter/nf_conntrack_core.c
> > @@ -486,7 +486,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
> > ct->timeout.expires += jiffies;
> > add_timer(&ct->timeout);
> > atomic_inc(&ct->ct_general.use);
> > - set_bit(IPS_CONFIRMED_BIT,&ct->status);
> > + ct->status |= IPS_CONFIRMED_BIT;
> >
> > /* Since the lookup is lockless, hash insertion must be done after
> > * starting the timer and setting the CONFIRMED bit. The RCU barriers
> > --
> NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
> get away with a non-atomic operation on this field. I'll defer to
> Patrick on that.
>
> I think you have to use IPS_CONFIRMED instead, e.g.,
>
> ct->status |= IPS_CONFIRMED;
>
Or
__set_bit(IPS_CONFIRMED_BIT, &ct->status);
set_bit() is atomic, while __set_bit() is not
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH net-next-2.6] packet: use vzalloc()
From: Eric Dumazet @ 2010-11-20 17:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Neil Horman
alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
vzalloc() instead of vmalloc()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
---
net/packet/af_packet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b6372dd..422705d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2367,7 +2367,7 @@ static inline char *alloc_one_pg_vec_page(unsigned long order,
* __get_free_pages failed, fall back to vmalloc
*/
*flags |= PGV_FROM_VMALLOC;
- buffer = vmalloc((1 << order) * PAGE_SIZE);
+ buffer = vzalloc((1 << order) * PAGE_SIZE);
if (buffer)
return buffer;
^ permalink raw reply related
* [PATCH net-2.6] net: allow GFP_HIGHMEM in __vmalloc()
From: Eric Dumazet @ 2010-11-20 17:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
We forgot to use __GFP_HIGHMEM in several __vmalloc() calls.
In ceph, add the missing flag.
In fib_trie.c, xfrm_hash.c and request_sock.c, using vzalloc() is
cleaner and allows using HIGHMEM pages as well.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/ceph/buffer.c | 2 +-
net/core/request_sock.c | 4 +---
net/ipv4/fib_trie.c | 2 +-
net/xfrm/xfrm_hash.c | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/net/ceph/buffer.c b/net/ceph/buffer.c
index 53d8abf..bf3e6a1 100644
--- a/net/ceph/buffer.c
+++ b/net/ceph/buffer.c
@@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
if (b->vec.iov_base) {
b->is_vmalloc = false;
} else {
- b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
+ b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL);
if (!b->vec.iov_base) {
kfree(b);
return NULL;
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 7552495..fceeb37 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
lopt_size += nr_table_entries * sizeof(struct request_sock *);
if (lopt_size > PAGE_SIZE)
- lopt = __vmalloc(lopt_size,
- GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
- PAGE_KERNEL);
+ lopt = vzalloc(lopt_size);
else
lopt = kzalloc(lopt_size, GFP_KERNEL);
if (lopt == NULL)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 200eb53..0f28034 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size)
if (size <= PAGE_SIZE)
return kzalloc(size, GFP_KERNEL);
else
- return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
+ return vzalloc(size);
}
static void __tnode_vfree(struct work_struct *arg)
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c
index a2023ec..1e98bc0 100644
--- a/net/xfrm/xfrm_hash.c
+++ b/net/xfrm/xfrm_hash.c
@@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
if (sz <= PAGE_SIZE)
n = kzalloc(sz, GFP_KERNEL);
else if (hashdist)
- n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
+ n = vzalloc(sz);
else
n = (struct hlist_head *)
__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
^ permalink raw reply related
* Greetings from Japan
From: Mr. Tsutomu Kimoto @ 2010-11-20 15:14 UTC (permalink / raw)
Greetings from Japan,
I need your partnership in receiving funds on my behalf.However is not
mandatory nor will I in any manner compel you to honor against your will.
Please do treat with regards as I look forward to your reply and possibly our
partnership.
Sincerely,
Mr. Tsutomu Kimoto
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
^ permalink raw reply
* Transfer Of $30,000,000.00 Million Dollars**
From: Dr.Raymond Kuo Fung CH'IEN. @ 2010-11-19 16:28 UTC (permalink / raw)
I am the Executive Director and Chief Financial Officer of the operations of
the Hang Seng Bank Ltd.I have a secured business suggestion for you,with a value
of $30,000,000.00 Million. Kindly contact me form more details EMAIL :
drraymondkuochien1@xnmsn.cn
Kind Regards,
Dr.Raymond Kuo Fung CH'IEN.
^ permalink raw reply
* [PATCH] bonding: change list contact to netdev@vger.kernel.org
From: Simon Horman @ 2010-11-20 21:48 UTC (permalink / raw)
To: netdev; +Cc: Jay Vosburgh
bonding-devel@lists.sourceforge.net seems only receive spam
and discussion seems to already occur on netdev@vger.kernel.org.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
MAINTAINERS | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 476fb3a..c88b39e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1377,7 +1377,7 @@ F: include/net/bluetooth/
BONDING DRIVER
M: Jay Vosburgh <fubar@us.ibm.com>
-L: bonding-devel@lists.sourceforge.net
+L: netdev@vger.kernel.org
W: http://sourceforge.net/projects/bonding/
S: Supported
F: drivers/net/bonding/
--
1.7.2.3
^ permalink raw reply related
* Winning Notice.........Congratulations
From: ITOCHU Corporation. @ 2010-11-19 19:56 UTC (permalink / raw)
We are please to inform you that your e-mail just won you 1,000.000.00 pounds
sterlings in the Yahoo/Msn.
lottery program fill your claim by sending your contact info such as
Names:Age:Address: occupation:country: Agent Name: Mrs. Rose Elvis
Email:claimsmicrosoft56@yahoo.com.hk
^ permalink raw reply
* Re: [PATCH] netfilter: remove an atomic bit operation
From: Changli Gao @ 2010-11-20 23:38 UTC (permalink / raw)
To: Eric Dumazet
Cc: tim.gardner, Patrick McHardy, David S. Miller, netfilter-devel,
netdev
In-Reply-To: <1290271804.2756.78.camel@edumazet-laptop>
On Sun, Nov 21, 2010 at 12:50 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le samedi 20 novembre 2010 à 09:03 -0700, Tim Gardner a écrit :
>
>> NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
>> get away with a non-atomic operation on this field. I'll defer to
>> Patrick on that.
>>
>> I think you have to use IPS_CONFIRMED instead, e.g.,
>>
>> ct->status |= IPS_CONFIRMED;
>>
>
> Or
>
> __set_bit(IPS_CONFIRMED_BIT, &ct->status);
>
>
> set_bit() is atomic, while __set_bit() is not
>
Oh, you are right. Thanks. My a previous patch accepted by Patrick has
the same problem.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] netfilter: don't use atomic bit operation
From: Changli Gao @ 2010-11-20 23:40 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev
In-Reply-To: <4CE1129E.5040505@trash.net>
On Mon, Nov 15, 2010 at 6:59 PM, Patrick McHardy <kaber@trash.net> wrote:
> On 14.11.2010 10:05, Changli Gao wrote:
>> As we own ct, and the others can't see it until we confirm it, we don't
>> need to use atomic bit operation on ct->status.
>>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>> ---
>> include/net/netfilter/nf_nat_core.h | 4 ++--
>> net/ipv4/netfilter/nf_nat_core.c | 4 ++--
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>> diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
>> index 33602ab..52ac1d8 100644
>> --- a/include/net/netfilter/nf_nat_core.h
>> +++ b/include/net/netfilter/nf_nat_core.h
>> @@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
>> enum nf_nat_manip_type manip)
>> {
>> if (manip == IP_NAT_MANIP_SRC)
>> - return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
>> + return IPS_SRC_NAT_DONE_BIT & ct->status;
>> else
>> - return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status);
>> + return IPS_DST_NAT_DONE_BIT & ct->status;
>> }
>
> Looks fine, but I changed the order to ct->status & ...
>
Sorry, I made a mistake. The suffix _BIT should be removed.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] netfilter: change IPS_*_BIT to IPS_*
From: Changli Gao @ 2010-11-21 0:13 UTC (permalink / raw)
To: Patrick McHardy
Cc: David S. Miller, netfilter-devel, netdev, Changli Gao,
Tim Gardner, Eric Dumazet
My previous patch made a mistake when converting atomic_set to a normal
bit 'or'. IPS_*_BIT should be replaced with IPS_*.
commit 76a2d3bcfcc86e2a8044258515b86492a37631a3
Author: Changli Gao <xiaosuo@gmail.com>
Date: Mon Nov 15 11:59:03 2010 +0100
netfilter: nf_nat: don't use atomic bit operation
As we own the conntrack and the others can't see it until we confirm it,
we don't need to use atomic bit operation on ct->status.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Cc: Tim Gardner <tim.gardner@canonical.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
---
include/net/netfilter/nf_nat_core.h | 4 ++--
net/ipv4/netfilter/nf_nat_core.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 5aec85c..3dc7b98 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
enum nf_nat_manip_type manip)
{
if (manip == IP_NAT_MANIP_SRC)
- return ct->status & IPS_SRC_NAT_DONE_BIT;
+ return ct->status & IPS_SRC_NAT_DONE;
else
- return ct->status & IPS_DST_NAT_DONE_BIT;
+ return ct->status & IPS_DST_NAT_DONE;
}
struct nlattr;
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index eb55835..21e6e92 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -323,9 +323,9 @@ nf_nat_setup_info(struct nf_conn *ct,
/* It's done. */
if (maniptype == IP_NAT_MANIP_DST)
- ct->status |= IPS_DST_NAT_DONE_BIT;
+ ct->status |= IPS_DST_NAT_DONE;
else
- ct->status |= IPS_SRC_NAT_DONE_BIT;
+ ct->status |= IPS_SRC_NAT_DONE;
return NF_ACCEPT;
}
^ permalink raw reply related
* Re: [PATCH net-next-2.6] packet: use vzalloc()
From: Neil Horman @ 2010-11-21 0:43 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1290274314.2756.84.camel@edumazet-laptop>
On Sat, Nov 20, 2010 at 06:31:54PM +0100, Eric Dumazet wrote:
> alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
> vzalloc() instead of vmalloc()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Thanks Eric!
> ---
> net/packet/af_packet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index b6372dd..422705d 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2367,7 +2367,7 @@ static inline char *alloc_one_pg_vec_page(unsigned long order,
> * __get_free_pages failed, fall back to vmalloc
> */
> *flags |= PGV_FROM_VMALLOC;
> - buffer = vmalloc((1 << order) * PAGE_SIZE);
> + buffer = vzalloc((1 << order) * PAGE_SIZE);
>
> if (buffer)
> return buffer;
>
>
>
^ permalink raw reply
* Re: Question regarding expected behavior of two udp sockets with SO_REUSEADDR set
From: Neil Horman @ 2010-11-21 0:50 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem
In-Reply-To: <1290267887.2756.75.camel@edumazet-laptop>
On Sat, Nov 20, 2010 at 04:44:47PM +0100, Eric Dumazet wrote:
> Le samedi 20 novembre 2010 à 10:04 -0500, Neil Horman a écrit :
>
> > Agreed. My thought was to add logic to udp_lib_lport_inuse such that, if
> > sk_reuse is set on both sockets, and the input snum is 0 (indicating autobind)
> > we should not allow binding sk to inet_sk(sk2)->num. Thoughts?
>
> I dont know, problem is this could be possible right now if sk2 is bound
> on 127.0.0.2 address. Adding this test would reduce possible space.
>
Well, yes, that is in fact the exact problem that I origionally described. Both
sockets are bound to the same port on 127.0.0.1 on the same system. Since both
sockets have SO_REUSEADDR set, this is allowed, but when either socket sends a
messaage, the delivery code does a lookup in __udp4_lib_lookup, and the sock
structure that gets returned there is ambiguous. It could be either of the two
bound sockets, and the result will depend on which order they exist in the
hslot->head list (since they will both by definition hash to the same bucket).
Another solution might be to treat daddr of 127 specially, and force a traversal
of the entire hslot->head list, delivering to every matching packet, but we
might need to do that for all locally owned daddrs, so I'm not sure thats a
great solution. Other thoughts welcome, including just leave it all well enough
alone :)
> Autobind is tricky, it chooses a port while address is part of the
> problem.
>
Agreed, I'm comming to understand that :)
Neil
^ permalink raw reply
* [PATCH 00/62] drivers/net: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: netdev, e1000-devel, linux-usb, linux-wireless, ath5k-devel,
ath9k-devel, liberta
Cc: socketcan-core, linux-kernel
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
Summary of sizes old and new. Compiled allyesconfig x86 only.
text data bss dec hex filename
2075402 67170 466644 2609216 27d040 (TOTALS) -new
2074597 70614 466668 2611879 27daa7 (TOTALS) -old
Joe Perches (62):
3c501: Use static const
3c503: Use static const
3c507: Use static const
3c527: Use static const
at1700: Use static const
benet: Use static const
bnx2: Use static const
bnx2x: Use static const
can: Use static const
chelsio: Use static const
cxgb3: Use static const
cxgb3: Use static const
cxgb4: Use static const
cxgb4vf: Use static const
e1000: Use static const
e1000: Use static const
e1000e: Use static const
e2100: Use static const
eepro: Use static const
eexpress: Use static const
gianfar: Use static const
hp: Use static const
igb: Use static const
irda: Use static const
irda: Use static const
ixgbe: Use static const
ixgbevf: Use static const
ixgb: Use static const
jme: Use static const
ksz884x: Use static const
netxen: Use static const
ni52: Use static const
ni65: Use static const
pcmcia: Use static const
qlcnic: Use static const
qlge: Use static const
r8169: Use static const
s2io: Use static const
skfp: Use static const
skge: Use static const
smc-ultra: Use static const
tg3: Use static const
tokenring: Use static const
tulip: Use static const
tulip: Use static const
usb: Use static const
vmxnet3: Use static const
wan: Use static const
wd: Use static const
ar9170: Use const
ath5k: Use static const
ath9k: Use static const
carl9170: Use static const
atmel: Use static const
b43: Use static const
iwlwifi: Use static const
libertas: Use static const
ray_cs: Use static const
rndis_wlan: Use static const
rt2x00: Use static const
wl12xx: Use static const
zd1211rw: Use const
drivers/net/3c501.c | 4 +-
drivers/net/3c503.c | 4 +-
drivers/net/3c507.c | 4 +-
drivers/net/3c527.c | 6 +-
drivers/net/at1700.c | 6 +-
drivers/net/benet/be_ethtool.c | 4 +-
drivers/net/benet/be_main.c | 10 ++--
drivers/net/bnx2.c | 46 ++++++++++++-----------
drivers/net/bnx2x/bnx2x_main.c | 6 ++-
drivers/net/can/sja1000/plx_pci.c | 2 +-
drivers/net/chelsio/sge.c | 10 ++---
drivers/net/cxgb3/ael1002.c | 24 ++++++------
drivers/net/cxgb3/t3_hw.c | 2 +-
drivers/net/cxgb4/t4_hw.c | 48 ++++++++++++------------
drivers/net/cxgb4vf/t4vf_hw.c | 2 +-
drivers/net/e1000/e1000_hw.c | 8 ++--
drivers/net/e1000/e1000_param.c | 13 +++---
drivers/net/e1000e/phy.c | 11 +++--
drivers/net/e2100.c | 2 +-
drivers/net/eepro.c | 9 ++--
drivers/net/eexpress.c | 2 +-
drivers/net/gianfar.c | 10 +++--
drivers/net/hp.c | 6 +-
drivers/net/igb/e1000_phy.c | 11 +++--
drivers/net/irda/act200l-sir.c | 2 +-
drivers/net/irda/donauboe.c | 4 +-
drivers/net/ixgb/ixgb_param.c | 21 +++++-----
drivers/net/ixgbe/ixgbe_ethtool.c | 22 ++++++----
drivers/net/ixgbevf/ethtool.c | 18 +++++---
drivers/net/jme.c | 4 +-
drivers/net/ksz884x.c | 20 +++++-----
drivers/net/netxen/netxen_nic_hw.c | 16 +++++---
drivers/net/ni52.c | 4 +-
drivers/net/ni65.c | 4 +-
drivers/net/pcmcia/nmclan_cs.c | 2 +-
drivers/net/qlcnic/qlcnic_hw.c | 15 ++++---
drivers/net/qlge/qlge_main.c | 13 +++---
drivers/net/r8169.c | 2 +-
drivers/net/s2io.c | 20 ++++++----
drivers/net/skfp/smt.c | 4 +-
drivers/net/skge.c | 4 +-
drivers/net/smc-ultra.c | 8 +++-
drivers/net/tg3.c | 26 ++++++-------
drivers/net/tokenring/ibmtr.c | 5 +-
drivers/net/tulip/de2104x.c | 18 ++++++---
drivers/net/tulip/tulip_core.c | 15 ++++---
drivers/net/usb/hso.c | 39 ++++++++-----------
drivers/net/vmxnet3/vmxnet3_drv.c | 4 +-
drivers/net/wan/dscc4.c | 6 +-
drivers/net/wd.c | 2 +-
drivers/net/wireless/ath/ar9170/cmd.c | 2 +-
drivers/net/wireless/ath/ath5k/ani.c | 34 ++++++++--------
drivers/net/wireless/ath/ath9k/ani.c | 8 ++--
drivers/net/wireless/ath/ath9k/ar5008_phy.c | 32 ++++++++-------
drivers/net/wireless/ath/ath9k/ar9002_phy.c | 12 +++--
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 10 ++--
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 8 ++-
drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 4 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 +-
drivers/net/wireless/ath/ath9k/eeprom_4k.c | 12 +++--
drivers/net/wireless/ath/ath9k/eeprom_9287.c | 14 +++---
drivers/net/wireless/ath/ath9k/eeprom_def.c | 17 +++++---
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +-
drivers/net/wireless/ath/ath9k/hw.c | 9 ++--
drivers/net/wireless/ath/ath9k/rc.c | 6 +-
drivers/net/wireless/ath/carl9170/cmd.c | 2 +-
drivers/net/wireless/atmel.c | 6 ++-
drivers/net/wireless/b43/phy_common.c | 8 ++-
drivers/net/wireless/b43/phy_n.c | 9 ++--
drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 6 +-
drivers/net/wireless/libertas/cfg.c | 2 +-
drivers/net/wireless/libertas/rx.c | 4 +-
drivers/net/wireless/ray_cs.c | 4 +-
drivers/net/wireless/rndis_wlan.c | 9 +++-
drivers/net/wireless/rt2x00/rt2800lib.c | 2 +-
drivers/net/wireless/wl12xx/wl1271_acx.c | 4 +-
drivers/net/wireless/zd1211rw/zd_chip.c | 4 +-
78 files changed, 422 insertions(+), 362 deletions(-)
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply
* [PATCH 02/62] 3c503: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
7938 140 1688 9766 2626 drivers/net/3c503.o.new
7951 140 1688 9779 2633 drivers/net/3c503.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/3c503.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index 4777a1c..d84f6e8 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -392,8 +392,8 @@ el2_open(struct net_device *dev)
int retval;
if (dev->irq < 2) {
- int irqlist[] = {5, 9, 3, 4, 0};
- int *irqp = irqlist;
+ static const int irqlist[] = {5, 9, 3, 4, 0};
+ const int *irqp = irqlist;
outb(EGACFR_NORM, E33G_GACFR); /* Enable RAM and interrupts. */
do {
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 05/62] at1700: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
9083 370 2232 11685 2da5 drivers/net/at1700.o.new
9167 370 2232 11769 2df9 drivers/net/at1700.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/at1700.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index 871b163..f4744fc 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -270,9 +270,9 @@ static const struct net_device_ops at1700_netdev_ops = {
static int __init at1700_probe1(struct net_device *dev, int ioaddr)
{
- char fmv_irqmap[4] = {3, 7, 10, 15};
- char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15};
- char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15};
+ static const char fmv_irqmap[4] = {3, 7, 10, 15};
+ static const char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15};
+ static const char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15};
unsigned int i, irq, is_fmv18x = 0, is_at1700 = 0;
int slot, ret = -ENODEV;
struct net_local *lp = netdev_priv(dev);
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 06/62] benet: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: Sathya Perla, Subbu Seetharaman, Sarveshwar Bandi, Ajit Khaparde
Cc: netdev, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
9920 56 1248 11224 2bd8 drivers/net/benet/be_ethtool.o.old
9839 56 1232 11127 2b77 drivers/net/benet/be_ethtool.o.new
38586 386 8624 47596 b9ec drivers/net/benet/be_main.o.old
38452 386 8624 47462 b966 drivers/net/benet/be_main.o.new
Use ARRAY_SIZE not magic numbers.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/benet/be_ethtool.c | 4 +++-
drivers/net/benet/be_main.c | 10 +++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 0f46366..b4be027 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -549,7 +549,9 @@ be_test_ddr_dma(struct be_adapter *adapter)
{
int ret, i;
struct be_dma_mem ddrdma_cmd;
- u64 pattern[2] = {0x5a5a5a5a5a5a5a5aULL, 0xa5a5a5a5a5a5a5a5ULL};
+ static const u64 pattern[2] = {
+ 0x5a5a5a5a5a5a5a5aULL, 0xa5a5a5a5a5a5a5a5ULL
+ };
ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
ddrdma_cmd.va = pci_alloc_consistent(adapter->pdev, ddrdma_cmd.size,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c36cd2f..a112b75 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2343,10 +2343,10 @@ static int be_flash_data(struct be_adapter *adapter,
int num_bytes;
const u8 *p = fw->data;
struct be_cmd_write_flashrom *req = flash_cmd->va;
- struct flash_comp *pflashcomp;
+ const struct flash_comp *pflashcomp;
int num_comp;
- struct flash_comp gen3_flash_types[9] = {
+ static const struct flash_comp gen3_flash_types[9] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g3},
{ FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT,
@@ -2366,7 +2366,7 @@ static int be_flash_data(struct be_adapter *adapter,
{ FLASH_NCSI_START_g3, IMG_TYPE_NCSI_FW,
FLASH_NCSI_IMAGE_MAX_SIZE_g3}
};
- struct flash_comp gen2_flash_types[8] = {
+ static const struct flash_comp gen2_flash_types[8] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g2},
{ FLASH_REDBOOT_START_g2, IMG_TYPE_REDBOOT,
@@ -2388,11 +2388,11 @@ static int be_flash_data(struct be_adapter *adapter,
if (adapter->generation == BE_GEN3) {
pflashcomp = gen3_flash_types;
filehdr_size = sizeof(struct flash_file_hdr_g3);
- num_comp = 9;
+ num_comp = ARRAY_SIZE(gen3_flash_types);
} else {
pflashcomp = gen2_flash_types;
filehdr_size = sizeof(struct flash_file_hdr_g2);
- num_comp = 8;
+ num_comp = ARRAY_SIZE(gen2_flash_types);
}
for (i = 0; i < num_comp; i++) {
if ((pflashcomp[i].optype == IMG_TYPE_NCSI_FW) &&
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 07/62] bnx2: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: Michael Chan; +Cc: netdev, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
92097 560 22488 115145 1c1c9 drivers/net/bnx2.o.new
92133 560 22488 115181 1c1ed drivers/net/bnx2.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/bnx2.c | 46 ++++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 062600b..7805a4b 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6801,28 +6801,30 @@ bnx2_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)
u32 *p = _p, i, offset;
u8 *orig_p = _p;
struct bnx2 *bp = netdev_priv(dev);
- u32 reg_boundaries[] = { 0x0000, 0x0098, 0x0400, 0x045c,
- 0x0800, 0x0880, 0x0c00, 0x0c10,
- 0x0c30, 0x0d08, 0x1000, 0x101c,
- 0x1040, 0x1048, 0x1080, 0x10a4,
- 0x1400, 0x1490, 0x1498, 0x14f0,
- 0x1500, 0x155c, 0x1580, 0x15dc,
- 0x1600, 0x1658, 0x1680, 0x16d8,
- 0x1800, 0x1820, 0x1840, 0x1854,
- 0x1880, 0x1894, 0x1900, 0x1984,
- 0x1c00, 0x1c0c, 0x1c40, 0x1c54,
- 0x1c80, 0x1c94, 0x1d00, 0x1d84,
- 0x2000, 0x2030, 0x23c0, 0x2400,
- 0x2800, 0x2820, 0x2830, 0x2850,
- 0x2b40, 0x2c10, 0x2fc0, 0x3058,
- 0x3c00, 0x3c94, 0x4000, 0x4010,
- 0x4080, 0x4090, 0x43c0, 0x4458,
- 0x4c00, 0x4c18, 0x4c40, 0x4c54,
- 0x4fc0, 0x5010, 0x53c0, 0x5444,
- 0x5c00, 0x5c18, 0x5c80, 0x5c90,
- 0x5fc0, 0x6000, 0x6400, 0x6428,
- 0x6800, 0x6848, 0x684c, 0x6860,
- 0x6888, 0x6910, 0x8000 };
+ static const u32 reg_boundaries[] = {
+ 0x0000, 0x0098, 0x0400, 0x045c,
+ 0x0800, 0x0880, 0x0c00, 0x0c10,
+ 0x0c30, 0x0d08, 0x1000, 0x101c,
+ 0x1040, 0x1048, 0x1080, 0x10a4,
+ 0x1400, 0x1490, 0x1498, 0x14f0,
+ 0x1500, 0x155c, 0x1580, 0x15dc,
+ 0x1600, 0x1658, 0x1680, 0x16d8,
+ 0x1800, 0x1820, 0x1840, 0x1854,
+ 0x1880, 0x1894, 0x1900, 0x1984,
+ 0x1c00, 0x1c0c, 0x1c40, 0x1c54,
+ 0x1c80, 0x1c94, 0x1d00, 0x1d84,
+ 0x2000, 0x2030, 0x23c0, 0x2400,
+ 0x2800, 0x2820, 0x2830, 0x2850,
+ 0x2b40, 0x2c10, 0x2fc0, 0x3058,
+ 0x3c00, 0x3c94, 0x4000, 0x4010,
+ 0x4080, 0x4090, 0x43c0, 0x4458,
+ 0x4c00, 0x4c18, 0x4c40, 0x4c54,
+ 0x4fc0, 0x5010, 0x53c0, 0x5444,
+ 0x5c00, 0x5c18, 0x5c80, 0x5c90,
+ 0x5fc0, 0x6000, 0x6400, 0x6428,
+ 0x6800, 0x6848, 0x684c, 0x6860,
+ 0x6888, 0x6910, 0x8000
+ };
regs->version = 0;
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 08/62] bnx2x: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: netdev, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
147632 349 34240 182221 2c7cd drivers/net/bnx2x/bnx2x_main.o.old
147588 349 34240 182177 2c7a1 drivers/net/bnx2x/bnx2x_main.o.new
Changed bnx2x_set_mac_addr_gen to use const *
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/bnx2x/bnx2x_main.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 2a50231..fbcffc6 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -6055,7 +6055,7 @@ static int bnx2x_func_stop(struct bnx2x *bp)
* @param cam_offset offset in a CAM to use
* @param is_bcast is the set MAC a broadcast address (for E1 only)
*/
-static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, u8 *mac,
+static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, const u8 *mac,
u32 cl_bit_vec, u8 cam_offset,
u8 is_bcast)
{
@@ -6181,7 +6181,9 @@ void bnx2x_set_eth_mac(struct bnx2x *bp, int set)
if (CHIP_IS_E1(bp)) {
/* broadcast MAC */
- u8 bcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ static const u8 bcast[ETH_ALEN] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+ };
bnx2x_set_mac_addr_gen(bp, set, bcast, 0, cam_offset + 1, 1);
}
}
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 09/62] can: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: netdev; +Cc: Wolfgang Grandegger, socketcan-core, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
4399 604 1160 6163 1813 drivers/net/can/sja1000/plx_pci.o.old
4396 604 1160 6160 1810 drivers/net/can/sja1000/plx_pci.o.new
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/can/sja1000/plx_pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index 437b5c7..231385b 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -383,7 +383,7 @@ static void plx_pci_reset_marathon(struct pci_dev *pdev)
{
void __iomem *reset_addr;
int i;
- int reset_bar[2] = {3, 5};
+ static const int reset_bar[2] = {3, 5};
plx_pci_reset_common(pdev);
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 10/62] chelsio: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Moved duplicated ch_mac_addr declarations to single static const file scope.
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
21712 305 5168 27185 6a31 drivers/net/chelsio/sge.o.new
21806 305 5168 27279 6a8f drivers/net/chelsio/sge.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/chelsio/sge.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 70221ca..f778b15 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -273,6 +273,10 @@ struct sge {
struct cmdQ cmdQ[SGE_CMDQ_N] ____cacheline_aligned_in_smp;
};
+static const u8 ch_mac_addr[ETH_ALEN] = {
+ 0x0, 0x7, 0x43, 0x0, 0x0, 0x0
+};
+
/*
* stop tasklet and free all pending skb's
*/
@@ -2012,10 +2016,6 @@ static void espibug_workaround_t204(unsigned long data)
continue;
if (!skb->cb[0]) {
- u8 ch_mac_addr[ETH_ALEN] = {
- 0x0, 0x7, 0x43, 0x0, 0x0, 0x0
- };
-
skb_copy_to_linear_data_offset(skb,
sizeof(struct cpl_tx_pkt),
ch_mac_addr,
@@ -2048,8 +2048,6 @@ static void espibug_workaround(unsigned long data)
if ((seop & 0xfff0fff) == 0xfff && skb) {
if (!skb->cb[0]) {
- u8 ch_mac_addr[ETH_ALEN] =
- {0x0, 0x7, 0x43, 0x0, 0x0, 0x0};
skb_copy_to_linear_data_offset(skb,
sizeof(struct cpl_tx_pkt),
ch_mac_addr,
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 11/62] cxgb3: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: Divy Le Ray; +Cc: netdev, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
8401 368 2008 10777 2a19 drivers/net/cxgb3/ael1002.o.new
8129 680 2008 10817 2a41 drivers/net/cxgb3/ael1002.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/cxgb3/ael1002.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/cxgb3/ael1002.c b/drivers/net/cxgb3/ael1002.c
index 35cd367..2028da9 100644
--- a/drivers/net/cxgb3/ael1002.c
+++ b/drivers/net/cxgb3/ael1002.c
@@ -292,7 +292,7 @@ unknown:
*/
static int ael2005_setup_sr_edc(struct cphy *phy)
{
- static struct reg_val regs[] = {
+ static const struct reg_val regs[] = {
{ MDIO_MMD_PMAPMD, 0xc003, 0xffff, 0x181 },
{ MDIO_MMD_PMAPMD, 0xc010, 0xffff, 0x448a },
{ MDIO_MMD_PMAPMD, 0xc04a, 0xffff, 0x5200 },
@@ -324,11 +324,11 @@ static int ael2005_setup_sr_edc(struct cphy *phy)
static int ael2005_setup_twinax_edc(struct cphy *phy, int modtype)
{
- static struct reg_val regs[] = {
+ static const struct reg_val regs[] = {
{ MDIO_MMD_PMAPMD, 0xc04a, 0xffff, 0x5a00 },
{ 0, 0, 0, 0 }
};
- static struct reg_val preemphasis[] = {
+ static const struct reg_val preemphasis[] = {
{ MDIO_MMD_PMAPMD, 0xc014, 0xffff, 0xfe16 },
{ MDIO_MMD_PMAPMD, 0xc015, 0xffff, 0xa000 },
{ 0, 0, 0, 0 }
@@ -393,7 +393,7 @@ static int ael2005_intr_clear(struct cphy *phy)
static int ael2005_reset(struct cphy *phy, int wait)
{
- static struct reg_val regs0[] = {
+ static const struct reg_val regs0[] = {
{ MDIO_MMD_PMAPMD, 0xc001, 0, 1 << 5 },
{ MDIO_MMD_PMAPMD, 0xc017, 0, 1 << 5 },
{ MDIO_MMD_PMAPMD, 0xc013, 0xffff, 0xf341 },
@@ -403,7 +403,7 @@ static int ael2005_reset(struct cphy *phy, int wait)
{ MDIO_MMD_PMAPMD, 0xc210, 0xffff, 0 },
{ 0, 0, 0, 0 }
};
- static struct reg_val regs1[] = {
+ static const struct reg_val regs1[] = {
{ MDIO_MMD_PMAPMD, 0xca00, 0xffff, 0x0080 },
{ MDIO_MMD_PMAPMD, 0xca12, 0xffff, 0 },
{ 0, 0, 0, 0 }
@@ -522,7 +522,7 @@ int t3_ael2005_phy_prep(struct cphy *phy, struct adapter *adapter,
*/
static int ael2020_setup_sr_edc(struct cphy *phy)
{
- static struct reg_val regs[] = {
+ static const struct reg_val regs[] = {
/* set CDR offset to 10 */
{ MDIO_MMD_PMAPMD, 0xcc01, 0xffff, 0x488a },
@@ -551,20 +551,20 @@ static int ael2020_setup_sr_edc(struct cphy *phy)
static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype)
{
/* set uC to 40MHz */
- static struct reg_val uCclock40MHz[] = {
+ static const struct reg_val uCclock40MHz[] = {
{ MDIO_MMD_PMAPMD, 0xff28, 0xffff, 0x4001 },
{ MDIO_MMD_PMAPMD, 0xff2a, 0xffff, 0x0002 },
{ 0, 0, 0, 0 }
};
/* activate uC clock */
- static struct reg_val uCclockActivate[] = {
+ static const struct reg_val uCclockActivate[] = {
{ MDIO_MMD_PMAPMD, 0xd000, 0xffff, 0x5200 },
{ 0, 0, 0, 0 }
};
/* set PC to start of SRAM and activate uC */
- static struct reg_val uCactivate[] = {
+ static const struct reg_val uCactivate[] = {
{ MDIO_MMD_PMAPMD, 0xd080, 0xffff, 0x0100 },
{ MDIO_MMD_PMAPMD, 0xd092, 0xffff, 0x0000 },
{ 0, 0, 0, 0 }
@@ -624,7 +624,7 @@ static int ael2020_get_module_type(struct cphy *phy, int delay_ms)
*/
static int ael2020_intr_enable(struct cphy *phy)
{
- struct reg_val regs[] = {
+ static const struct reg_val regs[] = {
/* output Module's Loss Of Signal (LOS) to LED */
{ MDIO_MMD_PMAPMD, AEL2020_GPIO_CFG+AEL2020_GPIO_LSTAT,
0xffff, 0x4 },
@@ -664,7 +664,7 @@ static int ael2020_intr_enable(struct cphy *phy)
*/
static int ael2020_intr_disable(struct cphy *phy)
{
- struct reg_val regs[] = {
+ static const struct reg_val regs[] = {
/* reset "link status" LED to "off" */
{ MDIO_MMD_PMAPMD, AEL2020_GPIO_CTRL,
0xffff, 0xb << (AEL2020_GPIO_LSTAT*4) },
@@ -701,7 +701,7 @@ static int ael2020_intr_clear(struct cphy *phy)
return err ? err : t3_phy_lasi_intr_clear(phy);
}
-static struct reg_val ael2020_reset_regs[] = {
+static const struct reg_val ael2020_reset_regs[] = {
/* Erratum #2: CDRLOL asserted, causing PMA link down status */
{ MDIO_MMD_PMAPMD, 0xc003, 0xffff, 0x3101 },
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
* [PATCH 12/62] cxgb3: Use static const
From: Joe Perches @ 2010-11-21 2:38 UTC (permalink / raw)
To: Divy Le Ray; +Cc: netdev, linux-kernel
In-Reply-To: <cover.1290305773.git.joe@perches.com>
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.
text data bss dec hex filename
42246 56 8816 51118 c7ae drivers/net/cxgb3/t3_hw.o.new
42198 104 8816 51118 c7ae drivers/net/cxgb3/t3_hw.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/cxgb3/t3_hw.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 0b19704..d55db6b 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1562,7 +1562,7 @@ static void tp_intr_handler(struct adapter *adapter)
{0}
};
- static struct intr_info tp_intr_info_t3c[] = {
+ static const struct intr_info tp_intr_info_t3c[] = {
{0x1fffffff, "TP parity error", -1, 1},
{F_FLMRXFLSTEMPTY, "TP out of Rx pages", -1, 1},
{F_FLMTXFLSTEMPTY, "TP out of Tx pages", -1, 1},
--
1.7.3.2.245.g03276.dirty
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox