* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: Steffen Klassert @ 2012-06-11 11:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120611.022911.885347106959530782.davem@davemloft.net>
On Mon, Jun 11, 2012 at 02:29:11AM -0700, David Miller wrote:
>
> -unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
> - unsigned short new_mtu,
> - struct net_device *dev)
> -{
> - unsigned short old_mtu = ntohs(iph->tot_len);
> - unsigned short est_mtu = 0;
> - struct inet_peer *peer;
> -
> - peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1);
> - if (peer) {
> - unsigned short mtu = new_mtu;
> -
> - if (new_mtu < 68 || new_mtu >= old_mtu) {
> - /* BSD 4.2 derived systems incorrectly adjust
> - * tot_len by the IP header length, and report
> - * a zero MTU in the ICMP message.
> - */
> - if (mtu == 0 &&
> - old_mtu >= 68 + (iph->ihl << 2))
> - old_mtu -= iph->ihl << 2;
> - mtu = guess_mtu(old_mtu);
> - }
> -
> - if (mtu < ip_rt_min_pmtu)
> - mtu = ip_rt_min_pmtu;
> - if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
> - unsigned long pmtu_expires;
> -
> - pmtu_expires = jiffies + ip_rt_mtu_expires;
> - if (!pmtu_expires)
> - pmtu_expires = 1UL;
> -
> - est_mtu = mtu;
> - peer->pmtu_learned = mtu;
> - peer->pmtu_expires = pmtu_expires;
> - atomic_inc(&__rt_peer_genid);
> - }
> -
> - inet_putpeer(peer);
> - }
> - return est_mtu ? : new_mtu;
> -}
> -
It seems that we don't cache the learned pmtu informations
in some cases with ip_rt_frag_needed() removed.
At least when doing a simple ping test on a network that has
a router with mtu 1300 along the path, the following happens:
bash-3.00# ping -c 4 -s 1400 192.168.40.2
PING 192.168.40.2 (192.168.40.2) 1400(1428) bytes of data.
>From 10.2.2.2 icmp_seq=1 Frag needed and DF set (mtu = 1300)
>From 10.2.2.2 icmp_seq=2 Frag needed and DF set (mtu = 1300)
>From 10.2.2.2 icmp_seq=3 Frag needed and DF set (mtu = 1300)
>From 10.2.2.2 icmp_seq=4 Frag needed and DF set (mtu = 1300)
--- 192.168.40.2 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3005ms
We should learn the pmtu information with the first packet,
all further packets should get fragmented according to
the learned informations. Unfortunately we don't cache
these informations:
bash-3.00# ip r g 192.168.40.2
192.168.40.2 via 192.168.20.1 dev eth0 src 192.168.20.2
cache
^ permalink raw reply
* Re: [PATCH 1/5] inet: Hide route peer accesses behind helpers.
From: David Miller @ 2012-06-11 11:19 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1339411862.6001.2015.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 11 Jun 2012 12:51:02 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> On Mon, 2012-06-11 at 02:29 -0700, David Miller wrote:
>> +static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *peer)
>> +{
>> + unsigned long val = (unsigned long) peer;
>> + unsigned long orig = *ptr;
>> +
>> + if (!(orig & INETPEER_BASE_BIT) || !val ||
>> + cmpxchg(ptr, orig, val) != orig)
>> + return false;
>> + return true;
>> +}
>
> If peer is NULL here, we return false;
Good catch.
--------------------
inet: Avoid potential NULL peer dereference.
We handle NULL in rt{,6}_set_peer but then our caller will try to pass
that NULL pointer into inet_putpeer() which isn't ready for it.
Fix this by moving the NULL check one level up, and then remove the
now unnecessary NULL check from inetpeer_ptr_set_peer().
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/inetpeer.h | 2 +-
net/ipv4/route.c | 11 ++++++-----
net/ipv6/route.c | 10 ++++++----
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index e15c086..c27c8f1 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -104,7 +104,7 @@ static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *p
unsigned long val = (unsigned long) peer;
unsigned long orig = *ptr;
- if (!(orig & INETPEER_BASE_BIT) || !val ||
+ if (!(orig & INETPEER_BASE_BIT) ||
cmpxchg(ptr, orig, val) != orig)
return false;
return true;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4c33ce3..842510d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1333,11 +1333,12 @@ void rt_bind_peer(struct rtable *rt, __be32 daddr, int create)
return;
peer = inet_getpeer_v4(base, daddr, create);
-
- if (!rt_set_peer(rt, peer))
- inet_putpeer(peer);
- else
- rt->rt_peer_genid = rt_peer_genid();
+ if (peer) {
+ if (!rt_set_peer(rt, peer))
+ inet_putpeer(peer);
+ else
+ rt->rt_peer_genid = rt_peer_genid();
+ }
}
/*
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d9ba480..58a3ec2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -313,10 +313,12 @@ void rt6_bind_peer(struct rt6_info *rt, int create)
return;
peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
- if (!rt6_set_peer(rt, peer))
- inet_putpeer(peer);
- else
- rt->rt6i_peer_genid = rt6_peer_genid();
+ if (peer) {
+ if (!rt6_set_peer(rt, peer))
+ inet_putpeer(peer);
+ else
+ rt->rt6i_peer_genid = rt6_peer_genid();
+ }
}
static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
--
1.7.10
^ permalink raw reply related
* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: David Miller @ 2012-06-11 11:20 UTC (permalink / raw)
To: steffen.klassert; +Cc: netdev
In-Reply-To: <20120611111659.GK27795@secunet.com>
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Mon, 11 Jun 2012 13:16:59 +0200
> It seems that we don't cache the learned pmtu informations
> in some cases with ip_rt_frag_needed() removed.
We need to find a way to implement this then, in such a way
that we have the route context used to send the ping packet
out.
Otherwise, it's impossible to record the information properly.
^ permalink raw reply
* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: David Miller @ 2012-06-11 11:28 UTC (permalink / raw)
To: steffen.klassert; +Cc: netdev
In-Reply-To: <20120611.042024.1022194952800114410.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Mon, 11 Jun 2012 04:20:24 -0700 (PDT)
> We need to find a way to implement this then, in such a way
> that we have the route context used to send the ping packet
> out.
The problem is RAW sockets right? If so, then this is where the
fix belongs.
There is nothing preventing the RAW socket code from remembering the
last route used, as well as the flow4 key used to look it up, and
processing the PMTU message appropriately in raw_err() using that
remembered information if the flow4 key matches.
^ permalink raw reply
* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: Steffen Klassert @ 2012-06-11 11:42 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120611.042813.401909584318598192.davem@davemloft.net>
On Mon, Jun 11, 2012 at 04:28:13AM -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 11 Jun 2012 04:20:24 -0700 (PDT)
>
> > We need to find a way to implement this then, in such a way
> > that we have the route context used to send the ping packet
> > out.
>
> The problem is RAW sockets right? If so, then this is where the
> fix belongs.
>
Hm, I've just tried with tracepath (udp) and I also don't see the
pmtu informations cached.
I still had no time to look deeper into the new inetpeer code,
I've just gave it a quick try. I'll try to find out what's going on.
^ permalink raw reply
* Server Rental & datacenter rack rental service in Hong Kong
From: borislamsv2 @ 2012-06-11 11:51 UTC (permalink / raw)
Dear All,
We have our own datacenter in Hong Kong & provide email/application/web rental service to clients.We are APNIC member & provide clean IP to clients.
Dell? PowerEdge? EnterpriseRack Mount Server
-Intel(R) Xeon(R) E3-1240 Processor (3.3GHz, 8M Cache, Turbo, 4C/8T, 80W)
-8GB RAM, 2x4GB, 1333MHz, DDR-3, Dual Ranked UDIMMs
-500GB, 3.5", 6Gbps SAS x 2
-Raid 1 Mirroring Protection
-Remote KVM (iDRAC6 Enterprise)
Every Dedicated Server Hosting Solution Also Includes:
Software Specification
- CentOS / Fedora / Debian / FreeBSD / Ubuntu / Redhat Linux
- Full root-level access
- Data Center Facilities
- Shared Local & International Bandwidth
- 2 IP Addresses Allocation
- Un-interruptible Power Supply (UPS) backed up by private diesel generator
- FM200¡§based fire suppression system
- 24x7 CRAC Air Conditioning and Humidity Control
- 24x7 Security Control
- 24x7 Remote Hand Service
Pls send us email for further information.Thanks,
Boris
boris@dedicatedserver.com.hk
(852)94088762
If you do not wish to further receive this event message, email "borislamsv2@gmail.com" to unsubscribe this message or remove your email from the list.
^ permalink raw reply
* [PATCH 0/4] Introduce generic set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:27 UTC (permalink / raw)
To: bhutchings, grundler, arnd, avi, mtosatti
Cc: linux-net-drivers, netdev, linux-kernel, linux-arch, kvm,
takuya.yoshikawa
KVM is using test_and_set_bit_le() for this missing function; this patch
series corrects this usage.
As some drivers have their own definitions of set_bit_le(), which seem
to be incompatible with the generic one, renaming is also needed.
Note: the whole series is against linux-next.
Takuya Yoshikawa (4):
drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
drivers/net/ethernet/dec/tulip: Add tulip_ prefix to set_bit_le()
bitops: Introduce generic set_bit_le()
KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()
drivers/net/ethernet/dec/tulip/de2104x.c | 7 +++----
drivers/net/ethernet/dec/tulip/tulip_core.c | 7 +++----
drivers/net/ethernet/sfc/efx.c | 4 ++--
drivers/net/ethernet/sfc/net_driver.h | 4 ++--
drivers/net/ethernet/sfc/nic.c | 4 ++--
include/asm-generic/bitops/le.h | 5 +++++
virt/kvm/kvm_main.c | 3 +--
7 files changed, 18 insertions(+), 16 deletions(-)
--
1.7.5.4
^ permalink raw reply
* [PATCH 1/4] drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:29 UTC (permalink / raw)
To: bhutchings
Cc: grundler, arnd, avi, mtosatti, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Needed to introduce generic set_bit_le().
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/sfc/efx.c | 4 ++--
drivers/net/ethernet/sfc/net_driver.h | 4 ++--
drivers/net/ethernet/sfc/nic.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index b95f2e1..de11449 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1976,14 +1976,14 @@ static void efx_set_rx_mode(struct net_device *net_dev)
netdev_for_each_mc_addr(ha, net_dev) {
crc = ether_crc_le(ETH_ALEN, ha->addr);
bit = crc & (EFX_MCAST_HASH_ENTRIES - 1);
- set_bit_le(bit, mc_hash->byte);
+ efx_set_bit_le(bit, mc_hash->byte);
}
/* Broadcast packets go through the multicast hash filter.
* ether_crc_le() of the broadcast address is 0xbe2612ff
* so we always add bit 0xff to the mask.
*/
- set_bit_le(0xff, mc_hash->byte);
+ efx_set_bit_le(0xff, mc_hash->byte);
}
if (efx->port_enabled)
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 0e57535..5e084bf 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1081,13 +1081,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue,
}
/* Set bit in a little-endian bitfield */
-static inline void set_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_set_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] |= (1 << (nr % 8));
}
/* Clear bit in a little-endian bitfield */
-static inline void clear_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] &= ~(1 << (nr % 8));
}
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index 4a9a5be..3abde7b 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -473,9 +473,9 @@ void efx_nic_init_tx(struct efx_tx_queue *tx_queue)
efx_reado(efx, ®, FR_AA_TX_CHKSM_CFG);
if (tx_queue->queue & EFX_TXQ_TYPE_OFFLOAD)
- clear_bit_le(tx_queue->queue, (void *)®);
+ efx_clear_bit_le(tx_queue->queue, (void *)®);
else
- set_bit_le(tx_queue->queue, (void *)®);
+ efx_set_bit_le(tx_queue->queue, (void *)®);
efx_writeo(efx, ®, FR_AA_TX_CHKSM_CFG);
}
--
1.7.5.4
^ permalink raw reply related
* [PATCH 2/4] drivers/net/ethernet/dec/tulip: Add tulip_ prefix to set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:30 UTC (permalink / raw)
To: grundler
Cc: bhutchings, arnd, avi, mtosatti, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Needed to introduce generic set_bit_le().
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Grant Grundler <grundler@parisc-linux.org>
---
drivers/net/ethernet/dec/tulip/de2104x.c | 7 +++----
drivers/net/ethernet/dec/tulip/tulip_core.c | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 61cc093..e635f1a 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -661,8 +661,7 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb,
new frame, not around filling de->setup_frame. This is non-deterministic
when re-entered but still correct. */
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
{
@@ -673,12 +672,12 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
u16 *eaddrs;
memset(hash_table, 0, sizeof(hash_table));
- set_bit_le(255, hash_table); /* Broadcast entry */
+ tulip_set_bit_le(255, hash_table); /* Broadcast entry */
/* This should work on big-endian machines as well. */
netdev_for_each_mc_addr(ha, dev) {
int index = ether_crc_le(ETH_ALEN, ha->addr) & 0x1ff;
- set_bit_le(index, hash_table);
+ tulip_set_bit_le(index, hash_table);
}
for (i = 0; i < 32; i++) {
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index c4f37ac..3a1ebd02 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -1010,8 +1010,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
new frame, not around filling tp->setup_frame. This is non-deterministic
when re-entered but still correct. */
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
{
@@ -1022,12 +1021,12 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
u16 *eaddrs;
memset(hash_table, 0, sizeof(hash_table));
- set_bit_le(255, hash_table); /* Broadcast entry */
+ tulip_set_bit_le(255, hash_table); /* Broadcast entry */
/* This should work on big-endian machines as well. */
netdev_for_each_mc_addr(ha, dev) {
int index = ether_crc_le(ETH_ALEN, ha->addr) & 0x1ff;
- set_bit_le(index, hash_table);
+ tulip_set_bit_le(index, hash_table);
}
for (i = 0; i < 32; i++) {
*setup_frm++ = hash_table[i];
--
1.7.5.4
^ permalink raw reply related
* [PATCH 3/4] bitops: Introduce generic set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:31 UTC (permalink / raw)
To: arnd
Cc: bhutchings, grundler, avi, mtosatti, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/asm-generic/bitops/le.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index f95c663..3e72143 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -54,6 +54,11 @@ static inline int test_bit_le(int nr, const void *addr)
return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}
+static inline void set_bit_le(int nr, void *addr)
+{
+ set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
+}
+
static inline void __set_bit_le(int nr, void *addr)
{
__set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 4/4] KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:32 UTC (permalink / raw)
To: avi, mtosatti
Cc: bhutchings, grundler, arnd, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Now that we have defined generic set_bit_le() we do not need to use
test_and_set_bit_le() for atomically setting a bit.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
virt/kvm/kvm_main.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 02cb440..560c502 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1485,8 +1485,7 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
if (memslot && memslot->dirty_bitmap) {
unsigned long rel_gfn = gfn - memslot->base_gfn;
- /* TODO: introduce set_bit_le() and use it */
- test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap);
+ set_bit_le(rel_gfn, memslot->dirty_bitmap);
}
}
--
1.7.5.4
^ permalink raw reply related
* kernel ipsec error
From: Marco Berizzi @ 2012-06-11 12:45 UTC (permalink / raw)
To: netdev
Hello everybody.
After 12 days uptime I got this message.
Linux is 3.3.5 32bit, running openswan
(this is an ipsec gateway/netfilter
firewall) and squid.
Jun 11 12:53:02 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
Jun 11 12:53:02 Pleiadi kernel: cache: kmalloc-2048, object size: 2048, buffer size: 2048, default order: 2, min order: 0
Jun 11 12:53:02 Pleiadi kernel: node 0: slabs: 61, objs: 476, free: 0
Jun 11 12:53:02 Pleiadi kernel: kworker/0:2: page allocation failure: order:0, mode:0x4020
Jun 11 12:53:02 Pleiadi kernel: Pid: 18004, comm: kworker/0:2 Not tainted 3.3.5 #1
Jun 11 12:53:02 Pleiadi kernel: Call Trace:
Jun 11 12:53:02 Pleiadi kernel: [<c104eada>] ? warn_alloc_failed+0xb7/0xc8
Jun 11 12:53:02 Pleiadi kernel: [<c104efbb>] ? __alloc_pages_nodemask+0x4d0/0x4dd
Jun 11 12:53:02 Pleiadi kernel: [<c1067754>] ? allocate_slab+0x57/0xbf
Jun 11 12:53:02 Pleiadi kernel: [<c10677f4>] ? new_slab+0x1f/0x11a
Jun 11 12:53:02 Pleiadi kernel: [<c10682dc>] ? __slab_alloc+0x13e/0x20e
Jun 11 12:53:02 Pleiadi kernel: [<c104ccc3>] ? mempool_free+0x47/0x4a
Jun 11 12:53:02 Pleiadi kernel: [<c106967f>] ? __kmalloc_track_caller+0x66/0xc2
Jun 11 12:53:02 Pleiadi kernel: [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel: [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel: [<c1184109>] ? __alloc_skb+0x4f/0xfc
Jun 11 12:53:02 Pleiadi kernel: [<c1184118>] ? __alloc_skb+0x5e/0xfc
Jun 11 12:53:02 Pleiadi kernel: [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel: [<cac211ab>] ? boomerang_rx+0x305/0x41c [3c59x]
Jun 11 12:53:02 Pleiadi kernel: [<cac209dc>] ? boomerang_interrupt+0x96/0x2c3 [3c59x]
Jun 11 12:53:02 Pleiadi kernel: [<c104082d>] ? handle_irq_event_percpu+0x26/0xe5
Jun 11 12:53:02 Pleiadi kernel: [<c1041f50>] ? cond_unmask_irq+0x1f/0x1f
Jun 11 12:53:02 Pleiadi kernel: [<c1040905>] ? handle_irq_event+0x19/0x24
Jun 11 12:53:02 Pleiadi kernel: [<c1041fad>] ? handle_level_irq+0x5d/0x67
Jun 11 12:53:02 Pleiadi kernel: <IRQ> [<c10033da>] ? do_IRQ+0x2b/0x7b
Jun 11 12:53:02 Pleiadi kernel: [<c11fc989>] ? common_interrupt+0x29/0x30
Jun 11 12:53:02 Pleiadi kernel: [<c11e007b>] ? bictcp_cong_avoid+0x21c/0x337
Jun 11 12:53:02 Pleiadi kernel: [<c11e20a1>] ? xfrm_policy_lookup_bytype+0x12a/0x144
Jun 11 12:53:02 Pleiadi kernel: [<c11e20d1>] ? __xfrm_policy_lookup+0x16/0x1a
Jun 11 12:53:02 Pleiadi kernel: [<c11e2e8b>] ? xfrm_bundle_lookup+0xe2/0x2e6
Jun 11 12:53:02 Pleiadi kernel: [<c11e2110>] ? xfrm_policy_lookup+0x3b/0x56
Jun 11 12:53:02 Pleiadi kernel: [<c1199b15>] ? flow_cache_lookup+0x102/0x203
Jun 11 12:53:02 Pleiadi kernel: [<c1199bd3>] ? flow_cache_lookup+0x1c0/0x203
Jun 11 12:53:02 Pleiadi kernel: [<c11e3219>] ? xfrm_lookup+0x151/0x356
Jun 11 12:53:02 Pleiadi kernel: [<c11e2da9>] ? xfrm_resolve_and_create_bundle+0x87/0x87
Jun 11 12:53:02 Pleiadi kernel: [<c11de161>] ? alloc_null_binding+0x22/0x27
Jun 11 12:53:02 Pleiadi kernel: [<c11de187>] ? nf_nat_rule_find+0x21/0x63
Jun 11 12:53:02 Pleiadi kernel: [<c11de1c0>] ? nf_nat_rule_find+0x5a/0x63
Jun 11 12:53:02 Pleiadi kernel: [<c11e39a4>] ? __xfrm_route_forward+0x60/0x7b
Jun 11 12:53:02 Pleiadi kernel: [<c11a9882>] ? ipv4_validate_peer+0x9/0x5c
Jun 11 12:53:02 Pleiadi kernel: [<c11ad72c>] ? ip_forward+0xe9/0x2c9
Jun 11 12:53:02 Pleiadi kernel: [<c11ac67a>] ? ip_rcv_finish+0x272/0x285
Jun 11 12:53:02 Pleiadi kernel: [<c11ac8a8>] ? ip_rcv+0x21b/0x23f
Jun 11 12:53:02 Pleiadi kernel: [<c118cd74>] ? __netif_receive_skb+0x22e/0x254
Jun 11 12:53:02 Pleiadi kernel: [<c118d57f>] ? process_backlog+0x48/0xfe
Jun 11 12:53:02 Pleiadi kernel: [<c118d7bf>] ? net_rx_action+0x5f/0xfb
Jun 11 12:53:02 Pleiadi kernel: [<c101f339>] ? __do_softirq+0x59/0xc2
Jun 11 12:53:02 Pleiadi kernel: [<c101f2e0>] ? local_bh_enable_ip+0x77/0x77
Jun 11 12:53:02 Pleiadi kernel: <IRQ> [<c101f25d>] ? local_bh_enable+0x6b/0x77
Jun 11 12:53:02 Pleiadi kernel: [<c11934e3>] ? neigh_periodic_work+0xbc/0xfa
Jun 11 12:53:02 Pleiadi kernel: [<c102919c>] ? process_one_work+0x13b/0x22f
Jun 11 12:53:02 Pleiadi kernel: [<c1193427>] ? neigh_connect+0x10/0x10
Jun 11 12:53:02 Pleiadi kernel: [<c1029377>] ? worker_thread+0xcc/0x183
Jun 11 12:53:02 Pleiadi kernel: [<c10292ab>] ? process_scheduled_works+0x1b/0x1b
Jun 11 12:53:02 Pleiadi kernel: [<c102c2f7>] ? kthread+0x6a/0x6f
Jun 11 12:53:02 Pleiadi kernel: [<c102c28d>] ? kthread_data+0xd/0xd
Jun 11 12:53:02 Pleiadi kernel: [<c11fc996>] ? kernel_thread_helper+0x6/0xd
Jun 11 12:53:02 Pleiadi kernel: Mem-Info:
Jun 11 12:53:02 Pleiadi kernel: DMA per-cpu:
Jun 11 12:53:02 Pleiadi kernel: CPU 0: hi: 0, btch: 1 usd: 0
Jun 11 12:53:02 Pleiadi kernel: Normal per-cpu:
Jun 11 12:53:02 Pleiadi kernel: CPU 0: hi: 42, btch: 7 usd: 43
Jun 11 12:53:02 Pleiadi kernel: active_anon:9112 inactive_anon:11797 isolated_anon:2
Jun 11 12:53:02 Pleiadi kernel: active_file:4294 inactive_file:5228 isolated_file:14
Jun 11 12:53:02 Pleiadi kernel: unevictable:0 dirty:152 writeback:15 unstable:0
Jun 11 12:53:02 Pleiadi kernel: free:290 slab_reclaimable:1335 slab_unreclaimable:3626
Jun 11 12:53:02 Pleiadi kernel: mapped:694 shmem:0 pagetables:323 bounce:0
Jun 11 12:53:02 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:804kB inactive_anon:7148kB active_file:1724kB inactive_file:2692kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:4kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:792kB slab_unreclaimable:1060kB kernel_stack:168kB pagetables:36kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Jun 11 12:53:02 Pleiadi kernel: lowmem_reserve[]: 0 142 142
Jun 11 12:53:02 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:35644kB inactive_anon:40040kB active_file:15452kB inactive_file:18220kB unevictable:0kB isolated(anon):8kB isolated(file):56kB present:146304kB mlocked:0kB dirty:604kB writeback:60kB mapped:2564kB shmem:0kB slab_reclaimable:4548kB slab_unreclaimable:13444kB kernel_stack:688kB pagetables:1256kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Jun 11 12:53:02 Pleiadi kernel: lowmem_reserve[]: 0 0 0
Jun 11 12:53:02 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 3*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
Jun 11 12:53:02 Pleiadi kernel: Normal: 77*4kB 28*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
Jun 11 12:53:02 Pleiadi kernel: 12854 total pagecache pages
Jun 11 12:53:02 Pleiadi kernel: 3325 pages in swap cache
Jun 11 12:53:02 Pleiadi kernel: Swap cache stats: add 418409, delete 415084, find 240218/313268
Jun 11 12:53:02 Pleiadi kernel: Free swap = 130908kB
Jun 11 12:53:02 Pleiadi kernel: Total swap = 151164kB
Jun 11 12:53:02 Pleiadi kernel: 40944 pages RAM
Jun 11 12:53:02 Pleiadi kernel: 1225 pages reserved
Jun 11 12:53:02 Pleiadi kernel: 12195 pages shared
Jun 11 12:53:02 Pleiadi kernel: 31896 pages non-shared
Jun 11 12:53:02 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
Jun 11 12:53:02 Pleiadi kernel: cache: kmalloc-2048, object size: 2048, buffer size: 2048, default order: 2, min order: 0
Jun 11 12:53:02 Pleiadi kernel: node 0: slabs: 61, objs: 476, free: 0
Jun 11 12:53:02 Pleiadi kernel: Switching to clocksource pit
I also got this error (unplug power cord necessary):
May 30 09:57:51 Pleiadi kernel: [<c11fc996>] ? kernel_thread_helper+0x6/0xd
May 30 09:57:51 Pleiadi kernel: Mem-Info:
May 30 09:57:51 Pleiadi kernel: DMA per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU 0: hi: 0, btch: 1 usd: 0
May 30 09:57:51 Pleiadi kernel: Normal per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU 0: hi: 42, btch: 7 usd: 41
May 30 09:57:51 Pleiadi kernel: active_anon:10335 inactive_anon:11540 isolated_anon:0
May 30 09:57:51 Pleiadi kernel: active_file:3924 inactive_file:4094 isolated_file:0
May 30 09:57:51 Pleiadi kernel: unevictable:0 dirty:153 writeback:0 unstable:0
May 30 09:57:51 Pleiadi kernel: free:290 slab_reclaimable:1445 slab_unreclaimable:3882
May 30 09:57:51 Pleiadi kernel: mapped:957 shmem:1 pagetables:321 bounce:0
May 30 09:57:51 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:2160kB inactive_anon:6808kB active_file:1792kB inactive_file:2324kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:28kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:444kB slab_unreclaimable:832kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 142 142
May 30 09:57:51 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:39180kB inactive_anon:39352kB active_file:13904kB inactive_file:14052kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:146304kB mlocked:0kB dirty:584kB writeback:0kB mapped:3616kB shmem:4kB slab_reclaimable:5336kB slab_unreclaimable:14696kB kernel_stack:864kB pagetables:1268kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 0 0
May 30 09:57:51 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 1*32kB 5*64kB 0*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
May 30 09:57:51 Pleiadi kernel: Normal: 1*4kB 0*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
May 30 09:57:51 Pleiadi kernel: 10792 total pagecache pages
May 30 09:57:51 Pleiadi kernel: 2773 pages in swap cache
May 30 09:57:51 Pleiadi kernel: Swap cache stats: add 284144, delete 281371, find 209552/259249
May 30 09:57:51 Pleiadi kernel: Free swap = 132416kB
May 30 09:57:51 Pleiadi kernel: Total swap = 151164kB
May 30 09:57:51 Pleiadi kernel: 40944 pages RAM
May 30 09:57:51 Pleiadi kernel: 1225 pages reserved
May 30 09:57:51 Pleiadi kernel: 11892 pages shared
May 30 09:57:51 Pleiadi kernel: 33496 pages non-shared
May 30 09:57:51 Pleiadi kernel: kworker/0:1: page allocation failure: order:0, mode:0x20
May 30 09:57:51 Pleiadi kernel: Pid: 16451, comm: kworker/0:1 Not tainted 3.3.5 #1
May 30 09:57:51 Pleiadi kernel: Call Trace:
May 30 09:57:51 Pleiadi kernel: [<c104eada>] ? warn_alloc_failed+0xb7/0xc8
May 30 09:57:51 Pleiadi kernel: [<c104efbb>] ? __alloc_pages_nodemask+0x4d0/0x4dd
May 30 09:57:51 Pleiadi kernel: [<c10f88ff>] ? sha1_final+0x62/0x8c
May 30 09:57:51 Pleiadi kernel: [<c104efd4>] ? __get_free_pages+0xc/0x28
May 30 09:57:51 Pleiadi kernel: [<c10f58ef>] ? blkcipher_walk_next+0x69/0x298
May 30 09:57:51 Pleiadi kernel: [<c10f5c99>] ? blkcipher_walk_first+0x159/0x17c
May 30 09:57:51 Pleiadi kernel: [<c10fc4c8>] ? crypto_cbc_decrypt+0x26/0x61
May 30 09:57:51 Pleiadi kernel: [<c10f7732>] ? shash_ahash_finup+0x4c/0x58
May 30 09:57:51 Pleiadi kernel: [<c10f5e29>] ? async_decrypt+0x40/0x46
May 30 09:57:51 Pleiadi kernel: [<c11013eb>] ? crypto_authenc_decrypt+0x6f/0x75
May 30 09:57:51 Pleiadi kernel: [<c11d99c8>] ? esp_input+0x280/0x29e
May 30 09:57:51 Pleiadi kernel: [<c11e7150>] ? xfrm_input+0x1b1/0x33e
May 30 09:57:51 Pleiadi kernel: [<c11e0a82>] ? xfrm4_rcv_encap+0x17/0x19
May 30 09:57:51 Pleiadi kernel: [<c11e0c9c>] ? xfrm4_rcv+0x13/0x17
May 30 09:57:51 Pleiadi kernel: [<c11ac313>] ? ip_local_deliver_finish+0x116/0x1a4
May 30 09:57:51 Pleiadi kernel: [<c11ac402>] ? ip_local_deliver+0x61/0x67
May 30 09:57:51 Pleiadi kernel: [<c11ac67a>] ? ip_rcv_finish+0x272/0x285
May 30 09:57:51 Pleiadi kernel: [<c11ac8a8>] ? ip_rcv+0x21b/0x23f
May 30 09:57:51 Pleiadi kernel: [<c118cd74>] ? __netif_receive_skb+0x22e/0x254
May 30 09:57:51 Pleiadi kernel: [<c118d57f>] ? process_backlog+0x48/0xfe
May 30 09:57:51 Pleiadi kernel: [<c118d7bf>] ? net_rx_action+0x5f/0xfb
May 30 09:57:51 Pleiadi kernel: [<c101f339>] ? __do_softirq+0x59/0xc2
May 30 09:57:51 Pleiadi kernel: [<c101f2e0>] ? local_bh_enable_ip+0x77/0x77
May 30 09:57:51 Pleiadi kernel: <IRQ> [<c101f25d>] ? local_bh_enable+0x6b/0x77
May 30 09:57:51 Pleiadi kernel: [<c1192663>] ? dst_destroy+0x42/0x97
May 30 09:57:51 Pleiadi kernel: [<c11e27d6>] ? xfrm_bundle_flo_delete+0x1e/0x2c
May 30 09:57:51 Pleiadi kernel: [<c119975c>] ? flow_entry_kill+0xf/0x1c
May 30 09:57:51 Pleiadi kernel: [<c11997c5>] ? flow_cache_gc_task+0x5c/0x65
May 30 09:57:51 Pleiadi kernel: [<c102919c>] ? process_one_work+0x13b/0x22f
May 30 09:57:51 Pleiadi kernel: [<c1199769>] ? flow_entry_kill+0x1c/0x1c
May 30 09:57:51 Pleiadi kernel: [<c1029377>] ? worker_thread+0xcc/0x183
May 30 09:57:51 Pleiadi kernel: [<c10292ab>] ? process_scheduled_works+0x1b/0x1b
May 30 09:57:51 Pleiadi kernel: [<c102c2f7>] ? kthread+0x6a/0x6f
May 30 09:57:51 Pleiadi kernel: [<c102c28d>] ? kthread_data+0xd/0xd
May 30 09:57:51 Pleiadi kernel: [<c11fc996>] ? kernel_thread_helper+0x6/0xd
May 30 09:57:51 Pleiadi kernel: Mem-Info:
May 30 09:57:51 Pleiadi kernel: DMA per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU 0: hi: 0, btch: 1 usd: 0
May 30 09:57:51 Pleiadi kernel: Normal per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU 0: hi: 42, btch: 7 usd: 41
May 30 09:57:51 Pleiadi kernel: active_anon:10335 inactive_anon:11540 isolated_anon:0
May 30 09:57:51 Pleiadi kernel: active_file:3924 inactive_file:4094 isolated_file:0
May 30 09:57:51 Pleiadi kernel: unevictable:0 dirty:153 writeback:0 unstable:0
May 30 09:57:51 Pleiadi kernel: free:290 slab_reclaimable:1445 slab_unreclaimable:3882
May 30 09:57:51 Pleiadi kernel: mapped:957 shmem:1 pagetables:321 bounce:0
May 30 09:57:51 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:2160kB inactive_anon:6808kB active_file:1792kB inactive_file:2324kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:28kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:444kB slab_unreclaimable:832kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 142 142
May 30 09:57:51 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:39180kB inactive_anon:39352kB active_file:13904kB inactive_file:14052kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:146304kB mlocked:0kB dirty:584kB writeback:0kB mapped:3616kB shmem:4kB slab_reclaimable:5336kB slab_unreclaimable:14696kB kernel_stack:864kB pagetables:1268kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 0 0
May 30 09:57:51 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 1*32kB 5*64kB 0*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
May 30 09:57:51 Pleiadi kernel: Normal: 1*4kB 0*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
May 30 09:57:51 Pleiadi kernel: 10792 total pagecache pages
May 30 09:57:51 Pleiadi kernel: 2773 pages in swap cache
May 30 09:57:51 Pleiadi kernel: Swap cache stats: add 284144, delete 281371, find 209552/259249
May 30 09:57:51 Pleiadi kernel: Free swap = 132416kB
May 30 09:57:51 Pleiadi kernel: Total swap = 151164kB
May 30 09:57:51 Pleiadi kernel: 40944 pages RAM
May 30 09:57:51 Pleiadi kernel: 1225 pages reserved
May 30 09:57:51 Pleiadi kernel: 11892 pages shared
May 30 09:57:51 Pleiadi kernel: 33496 pages non-shared
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel: cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel: node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel: cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel: node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel: cache: kmalloc-256, object size: 256, buffer size: 256, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel: node 0: slabs: 444, objs: 7104, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel: cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel: node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel: cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel: node 0: slabs: 306, objs: 14076, free: 0
May 30 10:02:22 Pleiadi kernel: klogd 1.4.1, log source = /proc/kmsg started.
^ permalink raw reply
* [PATCH] net: socket: fixed coding style issues.
From: Matthew Shaw @ 2012-06-11 13:17 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Matthew Shaw
Fixed an instance where brances are used but not needed, and some lines
in the comments and code that exceed the 80 character limit.
Signed-off-by: Matthew Shaw <shaw500@gmail.com>
---
net/socket.c | 137 ++++++++++++++++++++++++++++++++--------------------------
1 file changed, 75 insertions(+), 62 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 6e0ccc0..2133040 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -8,48 +8,48 @@
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
*
* Fixes:
- * Anonymous : NOTSOCK/BADF cleanup. Error fix in
- * shutdown()
- * Alan Cox : verify_area() fixes
- * Alan Cox : Removed DDI
- * Jonathan Kamens : SOCK_DGRAM reconnect bug
- * Alan Cox : Moved a load of checks to the very
- * top level.
- * Alan Cox : Move address structures to/from user
- * mode above the protocol layers.
- * Rob Janssen : Allow 0 length sends.
- * Alan Cox : Asynchronous I/O support (cribbed from the
- * tty drivers).
- * Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style)
- * Jeff Uphoff : Made max number of sockets command-line
- * configurable.
- * Matti Aarnio : Made the number of sockets dynamic,
- * to be allocated when needed, and mr.
- * Uphoff's max is used as max to be
- * allowed to allocate.
- * Linus : Argh. removed all the socket allocation
- * altogether: it's in the inode now.
- * Alan Cox : Made sock_alloc()/sock_release() public
- * for NetROM and future kernel nfsd type
- * stuff.
- * Alan Cox : sendmsg/recvmsg basics.
- * Tom Dyas : Export net symbols.
- * Marcin Dalecki : Fixed problems with CONFIG_NET="n".
- * Alan Cox : Added thread locking to sys_* calls
- * for sockets. May have errors at the
- * moment.
- * Kevin Buhr : Fixed the dumb errors in the above.
- * Andi Kleen : Some small cleanups, optimizations,
- * and fixed a copy_from_user() bug.
- * Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0)
- * Tigran Aivazian : Made listen(2) backlog sanity checks
- * protocol-independent
+ * Anonymous : NOTSOCK/BADF cleanup. Error fix in
+ * shutdown()
+ * Alan Cox : verify_area() fixes
+ * Alan Cox : Removed DDI
+ * Jonathan Kamens : SOCK_DGRAM reconnect bug
+ * Alan Cox : Moved a load of checks to the very
+ * top level.
+ * Alan Cox : Move address structures to/from user
+ * mode above the protocol layers.
+ * Rob Janssen : Allow 0 length sends.
+ * Alan Cox : Asynchronous I/O support (cribbed from the
+ * tty drivers).
+ * Niibe Yutaka : Asynchronous I/O for writes (4.4BSD style)
+ * Jeff Uphoff : Made max number of sockets command-line
+ * configurable.
+ * Matti Aarnio : Made the number of sockets dynamic,
+ * to be allocated when needed, and mr.
+ * Uphoff's max is used as max to be
+ * allowed to allocate.
+ * Linus : Argh. removed all the socket allocation
+ * altogether: it's in the inode now.
+ * Alan Cox : Made sock_alloc()/sock_release() public
+ * for NetROM and future kernel nfsd type
+ * stuff.
+ * Alan Cox : sendmsg/recvmsg basics.
+ * Tom Dyas : Export net symbols.
+ * Marcin Dalecki : Fixed problems with CONFIG_NET="n".
+ * Alan Cox : Added thread locking to sys_* calls
+ * for sockets. May have errors at the
+ * moment.
+ * Kevin Buhr : Fixed the dumb errors in the above.
+ * Andi Kleen : Some small cleanups, optimizations,
+ * and fixed a copy_from_user() bug.
+ * Tigran Aivazian : sys_send(args) calls sys_sendto(args, NULL, 0)
+ * Tigran Aivazian : Made listen(2) backlog sanity checks
+ * protocol-independent
*
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
*
*
* This module is effectively the top level interface to the BSD socket
@@ -128,8 +128,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
unsigned int flags);
/*
- * Socket files have a set of 'special' operations as well as the generic file ones. These don't appear
- * in the operation structures but are done directly via the socketcall() multiplexor.
+ * Socket files have a set of 'special' operations as well as the generic
+ * file ones. These don't appear in the operation structures but are done
+ * directly via the socketcall() multiplexor.
*/
static const struct file_operations socket_file_ops = {
@@ -181,7 +182,8 @@ static DEFINE_PER_CPU(int, sockets_in_use);
* invalid addresses -EFAULT is returned. On a success 0 is returned.
*/
-int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr)
+int move_addr_to_kernel(void __user *uaddr, int ulen,
+ struct sockaddr_storage *kaddr)
{
if (ulen < 0 || ulen > sizeof(struct sockaddr_storage))
return -EINVAL;
@@ -584,7 +586,8 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
}
EXPORT_SYMBOL(sock_sendmsg);
-static int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg, size_t size)
+static int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg,
+ size_t size)
{
struct kiocb iocb;
struct sock_iocb siocb;
@@ -711,7 +714,8 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock,
- struct msghdr *msg, size_t size, int flags)
+ struct msghdr *msg, size_t size,
+ int flags)
{
struct sock_iocb *si = kiocb_to_siocb(iocb);
@@ -1158,7 +1162,9 @@ static int sock_fasync(int fd, struct file *filp, int on)
return 0;
}
-/* This function may be called only under socket lock or callback_lock or rcu_lock */
+/* This function may be called only under socket lock or callback_lock
+ * or rcu_lock.
+ */
int sock_wake_async(struct socket *sock, int how, int band)
{
@@ -1229,8 +1235,8 @@ int __sock_create(struct net *net, int family, int type, int protocol,
/*
* Allocate the socket and allow the family to set things up. if
- * the protocol is 0, the family is instructed to select an appropriate
- * default.
+ * the protocol is 0, the family is instructed to select an
+ * appropriate default.
*/
sock = sock_alloc();
if (!sock) {
@@ -1308,7 +1314,8 @@ EXPORT_SYMBOL(__sock_create);
int sock_create(int family, int type, int protocol, struct socket **res)
{
- return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0);
+ return __sock_create(current->nsproxy->net_ns, family, type, protocol,
+ res, 0);
}
EXPORT_SYMBOL(sock_create);
@@ -1928,9 +1935,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg,
}
/* This will also move the address data into kernel space */
- if (MSG_CMSG_COMPAT & flags) {
+ if (MSG_CMSG_COMPAT & flags)
err = verify_compat_iovec(msg_sys, iov, &address, VERIFY_READ);
- } else
+ else
err = verify_iovec(msg_sys, iov, &address, VERIFY_READ);
if (err < 0)
goto out_freeiov;
@@ -1957,9 +1964,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg,
}
err = -EFAULT;
/*
- * Careful! Before this, msg_sys->msg_control contains a user pointer.
- * Afterwards, it will be a kernel pointer. Thus the compiler-assisted
- * checking falls down on this.
+ * Careful! Before this, msg_sys->msg_control contains a user
+ * pointer. Afterwards, it will be a kernel pointer. Thus the
+ * compiler-assisted checking falls down on this.
*/
if (copy_from_user(ctl_buf,
(void __user __force *)msg_sys->msg_control,
@@ -2010,7 +2017,8 @@ out:
* BSD sendmsg interface
*/
-SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, flags)
+SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int,
+ flags)
{
int fput_needed, err;
struct msghdr msg_sys;
@@ -2056,7 +2064,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
while (datagrams < vlen) {
if (MSG_CMSG_COMPAT & flags) {
- err = __sys_sendmsg(sock, (struct msghdr __user *)compat_entry,
+ err = __sys_sendmsg(sock,
+ (struct msghdr __user *)compat_entry,
&msg_sys, flags, &used_address);
if (err < 0)
break;
@@ -2132,9 +2141,9 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg,
uaddr = (__force void __user *)msg_sys->msg_name;
uaddr_len = COMPAT_NAMELEN(msg);
- if (MSG_CMSG_COMPAT & flags) {
+ if (MSG_CMSG_COMPAT & flags)
err = verify_compat_iovec(msg_sys, iov, &addr, VERIFY_WRITE);
- } else
+ else
err = verify_iovec(msg_sys, iov, &addr, VERIFY_WRITE);
if (err < 0)
goto out_freeiov;
@@ -2661,13 +2670,15 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
ifc.ifc_req = NULL;
uifc = compat_alloc_user_space(sizeof(struct ifconf));
} else {
- size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) *
+ size_t len = ((ifc32.ifc_len /
+ sizeof(struct compat_ifreq)) + 1) *
sizeof(struct ifreq);
uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
ifc.ifc_len = len;
ifr = ifc.ifc_req = (void __user *)(uifc + 1);
ifr32 = compat_ptr(ifc32.ifcbuf);
- for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) {
+ for (i = 0; i < ifc32.ifc_len;
+ i += sizeof(struct compat_ifreq)) {
if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq)))
return -EFAULT;
ifr++;
@@ -2832,7 +2843,8 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
return 0;
}
-static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32)
+static int compat_siocwandev(struct net *net,
+ struct compat_ifreq __user *uifr32)
{
void __user *uptr;
compat_uptr_t uptr32;
@@ -3000,7 +3012,8 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
return err;
}
-static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uifr32)
+static int compat_siocshwtstamp(struct net *net,
+ struct compat_ifreq __user *uifr32)
{
void __user *uptr;
compat_uptr_t uptr32;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Federico Vaga @ 2012-06-11 13:18 UTC (permalink / raw)
To: Bhupesh SHARMA
Cc: rubini@gnudd.com, anilkumar@ti.com, mkl@pengutronix.de,
alan@lxorguk.ukuu.org.uk, wg@grandegger.com, Giancarlo ASNAGHI,
alan@linux.intel.com, linux-can@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <D5ECB3C7A6F99444980976A8C6D896384FA5EC4E62@EAPEX1MAIL1.st.com>
How we proceed?
I submit my c_can_pci.c as a separated module, we create a
c_can_platform_common.c,
or we are thinking about a generic c_can.c as plaftorm driver?
--
Federico Vaga
^ permalink raw reply
* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Wolfgang Grandegger @ 2012-06-11 13:51 UTC (permalink / raw)
To: Alessandro Rubini
Cc: alan, federico.vaga, mkl, giancarlo.asnaghi, alan, linux-can,
netdev, linux-kernel
In-Reply-To: <20120604164531.GA22000@mail.gnudd.com>
On 06/04/2012 06:45 PM, Alessandro Rubini wrote:
>> Anythign wrong with
>>
>> bool aligned32;
>
> I personally think booleans are evil. But both this and the other
> thing:
>
>>> +static u16 c_can_pci_read_reg_aligned_to_16bit(struct c_can_priv *priv,
>>> + void *reg)
>>
>> I'm a bit worried this function name might be too short ;)
>
> come from the platform driver this is based on (I already blamed
> federico offlist for not preserving authorship of the original file).
>
> So, this file is mostly copied from the platform driver, which is a
> duplication of code. A mandated duplication, given how the thing
> is currently laid out: the c_can core driver exports functions that
> the other two files are using (the platform and the new pci driver).
>
> In my opinion, it would be much better to have one less layer and no
> exports at all. The core driver should be a platform driver, and the
> pci driver would just build platform data and register the platform
> device.
Do you have examples for that approach? Not sure yet if it really saves
code and makes it more readable.
> Sure this isn't up to federico, who has the pci device but cannot
> access any boards where the previous driver is used. What do the
> maintainers think? I (or federico :) may propose a reshaping, if
> the idea makes sense.
I would suggest to provide the c_can_pci driver using the *current* API,
even if it's not optimal. Federicos patch then already looks quite good.
It should use the new register access methods introduced by the D_CAN
support patch, though.
Any further improvements to the device abstraction and a more consistent
handling of the platform data are welcome.
Wolfgang.
^ permalink raw reply
* net: nfc: BUG and panic in accept() on 3.5-rc2
From: Sasha Levin @ 2012-06-11 14:00 UTC (permalink / raw)
To: David Miller, lauro.venancio, aloisio.almeida, sameo
Cc: Dave Jones, linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-wireless
Hi all,
I've stumbled on the following while fuzzing with trinity inside a KVM tools guest, running on 3.5-rc2:
[ 2136.383310] BUG: unable to handle kernel NULL pointer dereference at 00000000000003b0
[ 2136.384022] IP: [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0
[ 2136.384022] PGD 131c4067 PUD 11c0c067 PMD 0
[ 2136.388106] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 2136.388106] CPU 1
[ 2136.388106] Pid: 24855, comm: trinity-child1 Tainted: G W 3.5.0-rc2-sasha-00015-g7b268f7 #374
[ 2136.388106] RIP: 0010:[<ffffffff8114e400>] [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0
[ 2136.388106] RSP: 0018:ffff8800130b3ca8 EFLAGS: 00010046
[ 2136.388106] RAX: 0000000000000086 RBX: ffff88001186b000 RCX: 0000000000000000
[ 2136.388106] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 2136.388106] RBP: ffff8800130b3d08 R08: 0000000000000001 R09: 0000000000000000
[ 2136.388106] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000002
[ 2136.388106] R13: 00000000000003b0 R14: 0000000000000000 R15: 0000000000000000
[ 2136.388106] FS: 00007fa5b1bd4700(0000) GS:ffff88001b800000(0000) knlGS:0000000000000000
[ 2136.388106] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2136.388106] CR2: 00000000000003b0 CR3: 0000000011d1f000 CR4: 00000000000406e0
[ 2136.388106] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 2136.388106] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 2136.388106] Process trinity-child1 (pid: 24855, threadinfo ffff8800130b2000, task ffff88001186b000)
[ 2136.388106] Stack:
[ 2136.388106] ffff8800130b3cd8 ffffffff81121785 ffffffff81236774 000080d000000001
[ 2136.388106] ffff88001b9d6c00 00000000001d6c00 ffffffff130b3d08 ffff88001186b000
[ 2136.388106] 0000000000000000 0000000000000002 0000000000000000 0000000000000000
[ 2136.388106] Call Trace:
[ 2136.388106] [<ffffffff81121785>] ? sched_clock_local+0x25/0x90
[ 2136.388106] [<ffffffff81236774>] ? get_empty_filp+0x74/0x220
[ 2136.388106] [<ffffffff8114e97a>] lock_acquire+0x18a/0x1e0
[ 2136.388106] [<ffffffff836b37df>] ? rawsock_release+0x4f/0xa0
[ 2136.388106] [<ffffffff837c0ef0>] _raw_write_lock_bh+0x40/0x80
[ 2136.388106] [<ffffffff836b37df>] ? rawsock_release+0x4f/0xa0
[ 2136.388106] [<ffffffff836b37df>] rawsock_release+0x4f/0xa0
[ 2136.388106] [<ffffffff8321cfe8>] sock_release+0x18/0x70
[ 2136.388106] [<ffffffff8321d069>] sock_close+0x29/0x30
[ 2136.388106] [<ffffffff81236bca>] __fput+0x11a/0x2c0
[ 2136.388106] [<ffffffff81236d85>] fput+0x15/0x20
[ 2136.388106] [<ffffffff8321de34>] sys_accept4+0x1b4/0x200
[ 2136.388106] [<ffffffff837c165c>] ? _raw_spin_unlock_irq+0x4c/0x80
[ 2136.388106] [<ffffffff837c1669>] ? _raw_spin_unlock_irq+0x59/0x80
[ 2136.388106] [<ffffffff837c2565>] ? sysret_check+0x22/0x5d
[ 2136.388106] [<ffffffff8321de8b>] sys_accept+0xb/0x10
[ 2136.388106] [<ffffffff837c2539>] system_call_fastpath+0x16/0x1b
[ 2136.388106] Code: ec 04 00 0f 85 ea 03 00 00 be d5 0b 00 00 48 c7 c7 8a c1 40 84 e8 b1 a5 f8 ff 31 c0 e9 d4 03 00 00 66 2e 0f 1f 84 00 00 00 00 00 <49> 81 7d 00 60 73 5e 85 b8 01 00 00 00 44 0f 44 e0 83 fe 01 77
[ 2136.388106] RIP [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0
[ 2136.388106] RSP <ffff8800130b3ca8>
[ 2136.388106] CR2: 00000000000003b0
[ 2136.388106] ---[ end trace 6d450e935ee18982 ]---
[ 2136.388106] Kernel panic - not syncing: Fatal exception in interrupt
^ permalink raw reply
* Re: [PATCH 1/4] drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
From: Arnd Bergmann @ 2012-06-11 14:09 UTC (permalink / raw)
To: Takuya Yoshikawa
Cc: bhutchings, grundler, avi, mtosatti, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212901.2b4d0a17.yoshikawa.takuya@oss.ntt.co.jp>
On Monday 11 June 2012, Takuya Yoshikawa wrote:
>
> /* Set bit in a little-endian bitfield */
> -static inline void set_bit_le(unsigned nr, unsigned char *addr)
> +static inline void efx_set_bit_le(unsigned nr, unsigned char *addr)
> {
> addr[nr / 8] |= (1 << (nr % 8));
> }
>
> /* Clear bit in a little-endian bitfield */
> -static inline void clear_bit_le(unsigned nr, unsigned char *addr)
> +static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr)
> {
> addr[nr / 8] &= ~(1 << (nr % 8));
> }
Hmm, any reason why we're not just using the existing non-atomic
__set_bit_le() here? I think the helpers in sfc and tulip can
just get removed if you use those.
Arnd
^ permalink raw reply
* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Wolfgang Grandegger @ 2012-06-11 14:09 UTC (permalink / raw)
To: Federico Vaga
Cc: Marc Kleine-Budde, Giancarlo Asnaghi, Alan Cox, Alessandro Rubini,
linux-can, netdev, linux-kernel
In-Reply-To: <1338816766-7089-2-git-send-email-federico.vaga@gmail.com>
Hi Federico,
here comes my late review. Mark and others have already commented and I
will focus on further improvements...
On 06/04/2012 03:32 PM, Federico Vaga wrote:
A few more words would be nice here.
> Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
> Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
> Cc: Alan Cox <alan@linux.intel.com>
> ---
> drivers/net/can/c_can/Kconfig | 11 +-
> drivers/net/can/c_can/Makefile | 1 +
> drivers/net/can/c_can/c_can_pci.c | 221 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 230 insertions(+), 3 deletions(-)
> create mode 100644 drivers/net/can/c_can/c_can_pci.c
>
> diff --git a/drivers/net/can/c_can/Kconfig b/drivers/net/can/c_can/Kconfig
> index ffb9773..74ef97d 100644
> --- a/drivers/net/can/c_can/Kconfig
> +++ b/drivers/net/can/c_can/Kconfig
> @@ -2,14 +2,19 @@ menuconfig CAN_C_CAN
> tristate "Bosch C_CAN devices"
> depends on CAN_DEV && HAS_IOMEM
>
> -if CAN_C_CAN
> -
Please don't change unrelated things. It's done that way also in other
CAN subdirectories.
> config CAN_C_CAN_PLATFORM
> tristate "Generic Platform Bus based C_CAN driver"
> + depends on CAN_C_CAN
> ---help---
> This driver adds support for the C_CAN chips connected to
> the "platform bus" (Linux abstraction for directly to the
> processor attached devices) which can be found on various
> boards from ST Microelectronics (http://www.st.com)
> like the SPEAr1310 and SPEAr320 evaluation boards.
> -endif
> +
> +config CAN_C_CAN_PCI
> + tristate "Generic PCI Bus based C_CAN driver"
> + depends on CAN_C_CAN
> + ---help---
> + This driver adds support for the C_CAN chips connected to
> + the PCI bus.
> diff --git a/drivers/net/can/c_can/Makefile b/drivers/net/can/c_can/Makefile
> index 9273f6d..ad1cc84 100644
> --- a/drivers/net/can/c_can/Makefile
> +++ b/drivers/net/can/c_can/Makefile
> @@ -4,5 +4,6 @@
>
> obj-$(CONFIG_CAN_C_CAN) += c_can.o
> obj-$(CONFIG_CAN_C_CAN_PLATFORM) += c_can_platform.o
> +obj-$(CONFIG_CAN_C_CAN_PCI) += c_can_pci.o
>
> ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
> diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
> new file mode 100644
> index 0000000..b635375
> --- /dev/null
> +++ b/drivers/net/can/c_can/c_can_pci.c
> @@ -0,0 +1,221 @@
> +/*
> + * Platform CAN bus driver for Bosch C_CAN controller
s /Platform/PCI/ ?
> + *
> + * Copyright (C) 2012 Federico Vaga <federico.vaga@gmail.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/netdevice.h>
> +#include <linux/clk.h>
> +#include <linux/pci.h>
> +#include <linux/can/dev.h>
> +
> +#include "c_can.h"
> +
> +enum c_can_pci_reg_align {
> + C_CAN_REG_ALIGN_16,
> + C_CAN_REG_ALIGN_32,
> +};
> +
> +struct c_can_pci_data {
> + unsigned int reg_align; /* Set the register alignment in the memory */
Should be "enum c_can_pci_reg_align" here.
> + unsigned int freq; /* Set the frequency if clk is not usable */
> +};
> +
> +/*
> + * 16-bit c_can registers can be arranged differently in the memory
> + * architecture of different implementations. For example: 16-bit
> + * registers can be aligned to a 16-bit boundary or 32-bit boundary etc.
> + * Handle the same by providing a common read/write interface.
> + */
> +static u16 c_can_pci_read_reg_aligned_to_16bit(struct c_can_priv *priv,
> + void *reg)
> +{
> + return readw(reg);
> +}
> +
> +static void c_can_pci_write_reg_aligned_to_16bit(struct c_can_priv *priv,
> + void *reg, u16 val)
> +{
> + writew(val, reg);
> +}
> +
> +static u16 c_can_pci_read_reg_aligned_to_32bit(struct c_can_priv *priv,
> + void *reg)
> +{
> + return readw(reg + (long)reg - (long)priv->regs);
> +}
> +
> +static void c_can_pci_write_reg_aligned_to_32bit(struct c_can_priv *priv,
> + void *reg, u16 val)
> +{
> + writew(val, reg + (long)reg - (long)priv->regs);
> +}
This will look better with the new register access methods.
> +static int __devinit c_can_pci_probe(struct pci_dev *pdev,
> + const struct pci_device_id *ent)
> +{
> + struct c_can_pci_data *c_can_pci_data = (void *)ent->driver_data;
> + struct c_can_priv *priv;
> + struct net_device *dev;
> + void __iomem *addr;
> + struct clk *clk;
> + int ret;
> +
> + ret = pci_enable_device(pdev);
> + if (ret) {
> + dev_err(&pdev->dev, "pci_enable_device FAILED\n");
> + goto out;
> + }
> +
> + ret = pci_request_regions(pdev, KBUILD_MODNAME);
> + if (ret) {
> + dev_err(&pdev->dev, "pci_request_regions FAILED\n");
> + goto out_disable_device;
> + }
> +
> + pci_set_master(pdev);
> + pci_enable_msi(pdev);
> +
> + addr = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
> + if (!addr) {
> + dev_err(&pdev->dev,
> + "device has no PCI memory resources, "
> + "failing adapter\n");
> + ret = -ENOMEM;
> + goto out_release_regions;
> + }
> +
> + /* allocate the c_can device */
> + dev = alloc_c_can_dev();
> + if (!dev) {
> + ret = -ENOMEM;
> + goto out_iounmap;
> + }
> +
> + priv = netdev_priv(dev);
> + pci_set_drvdata(pdev, dev);
> + SET_NETDEV_DEV(dev, &pdev->dev);
> +
> + dev->irq = pdev->irq;
> + priv->regs = addr;
> +
> + if (!c_can_pci_data->freq) {
> + /* get the appropriate clk */
> + clk = clk_get(&pdev->dev, NULL);
> + if (IS_ERR(clk)) {
> + dev_err(&pdev->dev, "no clock defined\n");
> + ret = -ENODEV;
> + goto out_free_c_can;
> + }
> + priv->can.clock.freq = clk_get_rate(clk);
> + priv->priv = clk;
> + } else {
> + priv->can.clock.freq = c_can_pci_data->freq;
> + priv->priv = NULL;
> + }
> +
> + switch (c_can_pci_data->reg_align) {
> + case C_CAN_REG_ALIGN_32:
> + priv->read_reg = c_can_pci_read_reg_aligned_to_32bit;
> + priv->write_reg = c_can_pci_write_reg_aligned_to_32bit;
> + break;
> + case C_CAN_REG_ALIGN_16:
> + default:
> + priv->read_reg = c_can_pci_read_reg_aligned_to_16bit;
> + priv->write_reg = c_can_pci_write_reg_aligned_to_16bit;
> + break;
> + }
> +
> + ret = register_c_can_dev(dev);
> + if (ret) {
> + dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
> + KBUILD_MODNAME, ret);
> + goto out_free_clock;
> + }
> +
> + dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
> + KBUILD_MODNAME, priv->regs, dev->irq);
> +
> + return 0;
> +
> +out_free_clock:
> + if (!priv->priv)
> + clk_put(priv->priv);
> +out_free_c_can:
> + pci_set_drvdata(pdev, NULL);
> + free_c_can_dev(dev);
> +out_iounmap:
> + pci_iounmap(pdev, addr);
> +out_release_regions:
> + pci_disable_msi(pdev);
> + pci_clear_master(pdev);
> + pci_release_regions(pdev);
> +out_disable_device:
> + /*
> + * do not call pci_disable_device on sta2x11 because it
> + * break all other Bus masters on this EP
> + */
Puh!
> + if(pdev->vendor == PCI_VENDOR_ID_STMICRO &&
> + pdev->device == PCI_DEVICE_ID_STMICRO_CAN)
> + goto out;
> + pci_disable_device(pdev);
> +out:
> + return ret;
> +}
> +
> +static void __devexit c_can_pci_remove(struct pci_dev *pdev)
> +{
> + struct net_device *dev = pci_get_drvdata(pdev);
> + struct c_can_priv *priv = netdev_priv(dev);
> +
> + pci_set_drvdata(pdev, NULL);
> + free_c_can_dev(dev);
Should be moved a few line down.
> + if (!priv->priv)
> + clk_put(priv->priv);
> + pci_iounmap(pdev, priv->regs);
> + pci_disable_msi(pdev);
> + pci_clear_master(pdev);
> + pci_release_regions(pdev);
> + /*
> + * do not call pci_disable_device on sta2x11 because it
> + * break all other Bus masters on this EP
> + */
> + if(pdev->vendor == PCI_VENDOR_ID_STMICRO &&
> + pdev->device == PCI_DEVICE_ID_STMICRO_CAN)
> + return;
> + pci_disable_device(pdev);
> +}
> +
> +static struct c_can_pci_data c_can_sta2x11= {
> + .reg_align = C_CAN_REG_ALIGN_32,
> + .freq = 52000000, /* 52 Mhz */
> +};
> +
> +#define C_CAN_ID(_vend, _dev, _driverdata) { \
> + PCI_DEVICE(_vend, _dev), \
> + .driver_data = (unsigned long)&_driverdata, \
> +}
> +DEFINE_PCI_DEVICE_TABLE(c_can_pci_tbl) = {
> + C_CAN_ID(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_CAN,
> + c_can_sta2x11),
> + {},
> +};
> +static struct pci_driver sta2x11_pci_driver = {
Why do you not use a generic name here?
> + .name = KBUILD_MODNAME,
> + .id_table = c_can_pci_tbl,
> + .probe = c_can_pci_probe,
> + .remove = __devexit_p(c_can_pci_remove),
> +};
> +
> +module_pci_driver(sta2x11_pci_driver);
> +
> +MODULE_AUTHOR("Federico Vaga <federico.vaga@gmail.com>");
> +MODULE_LICENSE("GPL V2");
> +MODULE_DESCRIPTION("PCI CAN bus driver for Bosch C_CAN controller");
> +MODULE_DEVICE_TABLE(pci, c_can_pci_tbl);
Thanks for your contribution.
Wolfgang.
^ permalink raw reply
* Re: [PATCH 3/4] bitops: Introduce generic set_bit_le()
From: Arnd Bergmann @ 2012-06-11 14:10 UTC (permalink / raw)
To: Takuya Yoshikawa
Cc: bhutchings, grundler, avi, mtosatti, linux-net-drivers, netdev,
linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611213101.5969fde5.yoshikawa.takuya@oss.ntt.co.jp>
On Monday 11 June 2012, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
>
> Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
> being used for this missing function.
>
> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> Cc: Arnd Bergmann <arnd@arndb.de>
I would recommend adding the corresponding clear_bit_le() along with
set_bit_le, so the next person who needs that doesn't have to make
yet another patch.
Arnd
^ permalink raw reply
* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Wolfgang Grandegger @ 2012-06-11 14:21 UTC (permalink / raw)
To: Federico Vaga
Cc: Bhupesh SHARMA, rubini@gnudd.com, anilkumar@ti.com,
mkl@pengutronix.de, alan@lxorguk.ukuu.org.uk, Giancarlo ASNAGHI,
alan@linux.intel.com, linux-can@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <CAH5GJ0qgQJZwO8xn-zkMA_mMhVM=uCjuCZjd8EbJr0NyE6i+tQ@mail.gmail.com>
On 06/11/2012 03:18 PM, Federico Vaga wrote:
> How we proceed?
> I submit my c_can_pci.c as a separated module, we create a
> c_can_platform_common.c,
> or we are thinking about a generic c_can.c as plaftorm driver?
I would accept your patch with the remaining fixes especially the new
register access methods introduced by the D_CAN support patch recently.
Any further improvements to the device abstraction and a more consistent
handling of the platform data or register access should be addressed by
sub-sequent patches.
Wolfgang.
^ permalink raw reply
* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Alessandro Rubini @ 2012-06-11 14:23 UTC (permalink / raw)
To: wg
Cc: alan, federico.vaga, mkl, giancarlo.asnaghi, alan, linux-can,
netdev, linux-kernel
In-Reply-To: <4FD5F7F1.3010602@grandegger.com>
>> In my opinion, it would be much better to have one less layer and no
>> exports at all. The core driver should be a platform driver, and the
>> pci driver would just build platform data and register the platform
>> device.
>
> Do you have examples for that approach? Not sure yet if it really saves
> code and makes it more readable.
Maybe the physmap mtd driver is a good example. Everybody's using it
(but not from PCI). I found drivers/pcmcia/bcm63xx_pcmcia.c that
registers a platform driver from a pci probe function, but I'm sure
there are other ones.
OTOH, I have another example of how not to do stuff, but I won't point
fingers now (it's not a CAN thing).
I just think the platform bus is there just for this reason: to provide
data to a generic driver, without module dependencies and such stuff.
> I would suggest to provide the c_can_pci driver using the *current* API,
> even if it's not optimal. Federicos patch then already looks quite good.
> It should use the new register access methods introduced by the D_CAN
> support patch, though.
Great. When it's in I'll show my proposal as an RFC patch, as time permits,
so we'll see if it's better or not.
> Any further improvements to the device abstraction and a more consistent
> handling of the platform data are welcome.
Good to know, thanks a lot
/alessandro
^ permalink raw reply
* Re: [PATCH] usbnet: Activate the halt interrupt endpoint to fix endless "XactErr" error
From: Huajun Li @ 2012-06-11 14:41 UTC (permalink / raw)
To: David Miller, Ming Lei, Alan Stern; +Cc: linux-usb, netdev
In-Reply-To: <20120607.145438.1351539405712214173.davem@davemloft.net>
On Fri, Jun 8, 2012 at 5:54 AM, David Miller <davem@davemloft.net> wrote:
> From: Huajun Li <huajun.li.lee@gmail.com>
> Date: Tue, 5 Jun 2012 22:12:17 +0800
>
>> There prints endless "XactErr" error msg once switch my device to the
>> configuration
>> which needs cdc_ether driver, the root cause is the interrupt endpoint halts.
>> Maybe this is a common issue, so fix it by activating the endpoint
>> once the error occurs.
>>
>> Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
>
> A USB expert needs to review this as I lack the knowledge to adequately
> go over this patch.
Update the patch according to Ming and Alan's comments, it only
handles "-EPIPE" error of interrupt endpoint. Welcome comments:
=============================================
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 9f58330..bd8ebef 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -537,6 +537,10 @@ static void intr_complete (struct urb *urb)
"intr shutdown, code %d\n", status);
return;
+ case -EPIPE:
+ usbnet_defer_kevent(dev, EVENT_STS_HALT);
+ return;
+
/* NOTE: not throttling like RX/TX, since this endpoint
* already polls infrequently
*/
@@ -967,6 +971,33 @@ fail_halt:
}
}
+ if (test_bit(EVENT_STS_HALT, &dev->flags)) {
+ unsigned pipe;
+ struct usb_endpoint_descriptor *desc;
+
+ desc = &dev->status->desc;
+ pipe = usb_rcvintpipe(dev->udev,
+ desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
+ status = usb_autopm_get_interface(dev->intf);
+ if (status < 0)
+ goto fail_sts;
+ status = usb_clear_halt(dev->udev, pipe);
+ if (status < 0) {
+ usb_autopm_put_interface(dev->intf);
+fail_sts:
+ netdev_err(dev->net,
+ "can't clear intr halt, status %d\n", status);
+ } else {
+ clear_bit(EVENT_STS_HALT, &dev->flags);
+ status = usb_submit_urb(dev->interrupt, GFP_KERNEL);
+ if (status != 0)
+ netif_err(dev, timer, dev->net,
+ "intr resubmit --> %d\n", status);
+
+ usb_autopm_put_interface(dev->intf);
+ }
+ }
+
/* tasklet could resubmit itself forever if memory is tight */
if (test_bit (EVENT_RX_MEMORY, &dev->flags)) {
struct urb *urb = NULL;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 76f4396..c0bcb61 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -62,13 +62,14 @@ struct usbnet {
unsigned long flags;
# define EVENT_TX_HALT 0
# define EVENT_RX_HALT 1
-# define EVENT_RX_MEMORY 2
-# define EVENT_STS_SPLIT 3
-# define EVENT_LINK_RESET 4
-# define EVENT_RX_PAUSED 5
-# define EVENT_DEV_WAKING 6
-# define EVENT_DEV_ASLEEP 7
-# define EVENT_DEV_OPEN 8
+# define EVENT_STS_HALT 2
+# define EVENT_RX_MEMORY 3
+# define EVENT_STS_SPLIT 4
+# define EVENT_LINK_RESET 5
+# define EVENT_RX_PAUSED 6
+# define EVENT_DEV_WAKING 7
+# define EVENT_DEV_ASLEEP 8
+# define EVENT_DEV_OPEN 9
};
static inline struct usb_driver *driver_of(struct usb_interface *intf)
^ permalink raw reply related
* Re: net: nfc: BUG and panic in accept() on 3.5-rc2
From: Eric Dumazet @ 2012-06-11 14:41 UTC (permalink / raw)
To: Samuel Ortiz
Cc: Sasha Levin, David Miller, lauro.venancio, aloisio.almeida,
Dave Jones, linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-wireless
In-Reply-To: <20120611144134.GX22557@sortiz-mobl>
On Mon, 2012-06-11 at 16:41 +0200, Samuel Ortiz wrote:
> Hi Sasha,
>
> On Mon, Jun 11, 2012 at 04:00:41PM +0200, Sasha Levin wrote:
> > Hi all,
> >
> > I've stumbled on the following while fuzzing with trinity inside a KVM tools guest, running on 3.5-rc2:
> >
> Thanks for the report, it could be worth adding this one to
> bugzilla.kernel.org.
>
> What's trinity ?
> Also, if this one is reproducible, would you mind sharing some details about
> how we could reproduce it ?
Well, bugfix should be trivial enough ;)
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index ec1134c..208416e 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -54,11 +54,12 @@ static int rawsock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- pr_debug("sock=%p\n", sock);
-
- sock_orphan(sk);
- sock_put(sk);
+ pr_debug("sock=%p sk=%p\n", sock, sk);
+ if (sk) {
+ sock_orphan(sk);
+ sock_put(sk);
+ }
return 0;
}
^ permalink raw reply related
* Re: net: nfc: BUG and panic in accept() on 3.5-rc2
From: Samuel Ortiz @ 2012-06-11 14:41 UTC (permalink / raw)
To: Sasha Levin
Cc: David Miller, lauro.venancio, aloisio.almeida, Dave Jones,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-wireless
In-Reply-To: <1339423241.4999.53.camel@lappy>
Hi Sasha,
On Mon, Jun 11, 2012 at 04:00:41PM +0200, Sasha Levin wrote:
> Hi all,
>
> I've stumbled on the following while fuzzing with trinity inside a KVM tools guest, running on 3.5-rc2:
>
Thanks for the report, it could be worth adding this one to
bugzilla.kernel.org.
What's trinity ?
Also, if this one is reproducible, would you mind sharing some details about
how we could reproduce it ?
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply
* Re: [PATCH net-next 0/4] 6lowpan: set of bug fixes
From: Tony Cheneau @ 2012-06-11 14:45 UTC (permalink / raw)
To: netdev, linux-zigbee-devel; +Cc: alex.bluesman.smirnov
In-Reply-To: <20120611003741.27263005@dualbox>
Hello,
As Jan pointed out, it seems that the third patch of my patchset is not
formatted properly. Moreover, I got my own email address wrong. Please
disregard the whole patchset as I need to investigate the issue. I'll
repost the complete patchset when it will be resolved.
I'm sorry if it caused any of you to waste your time on it.
Regards,
Tony
Le 11.06.2012 06:37, Tony Cheneau a écrit :
> Hello,
>
> (This is my first time submitting patches. If I fail to apply to
> some rules in here, please let me know)
>
> After reading the 6lowpan code, I found a few issues. This patchset
> fixes them. This patchset should apply cleanly against the current
> net-next. It contains only bug fixes, I'll send later on a few other
> patches that will offer new functionalities.
>
> This is a set of 4 small patches that correct bugs in 6lowpan:
> - patch 1 fixes a potential crash when reassembling UDP fragments
> - patch 2 fixes a type issues that prevent the fragmentation
> reassembly
> to operate properly.
> - patch 3 and 4 corrects field encoding issues
>
> Hope it helps.
>
> Regards,
> Tony Cheneau
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" 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
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