* [net 2/3] caif-hsi: Bugfix - Piggyback'ed embedded CAIF frame lost
From: sjur.brandeland @ 2012-06-24 21:01 UTC (permalink / raw)
To: davem; +Cc: netdev, sjurbren, Per Ellefsen, Per Ellefsen,
Sjur Brændeland
In-Reply-To: <1340571698-17892-1-git-send-email-sjur.brandeland@stericsson.com>
From: Per Ellefsen <Per.Ellefsen@stericsson.com>
When receiving a piggyback'ed descriptor containing an
embedded frame, but no payload, the embedded frame was
lost.
Signed-off-by: Per Ellefsen <per.ellefsen@stericsson.com>
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
drivers/net/caif/caif_hsi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 1520814..1f52ff3 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -693,8 +693,6 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)
*/
memcpy(rx_buf, (u8 *)piggy_desc,
CFHSI_DESC_SHORT_SZ);
- /* Mark no embedded frame here */
- piggy_desc->offset = 0;
if (desc_pld_len == -EPROTO)
goto out_of_sync;
}
@@ -737,6 +735,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)
/* Extract any payload in piggyback descriptor. */
if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0)
goto out_of_sync;
+ /* Mark no embedded frame after extracting it */
+ piggy_desc->offset = 0;
}
}
--
1.7.5.4
^ permalink raw reply related
* [net 3/3] caif-hsi: Add missing return in error path
From: sjur.brandeland @ 2012-06-24 21:01 UTC (permalink / raw)
To: davem; +Cc: netdev, sjurbren, Sjur Brændeland
In-Reply-To: <1340571698-17892-1-git-send-email-sjur.brandeland@stericsson.com>
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Fix a missing return, causing access to freed memory.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
drivers/net/caif/caif_hsi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 1f52ff3..4a27adb 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -1178,6 +1178,7 @@ int cfhsi_probe(struct platform_device *pdev)
dev_err(&ndev->dev, "%s: Registration error: %d.\n",
__func__, res);
free_netdev(ndev);
+ return -ENODEV;
}
/* Add CAIF HSI device to list. */
spin_lock(&cfhsi_list_lock);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 1/1] ipheth: add support for iPad
From: rainbow @ 2012-06-24 22:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, netdev, linux-kernel, rainbow
This adds support for the iPad to the ipheth driver.
(product id = 0x129a)
Signed-off-by: rainbow <rainbow@irh.it>
---
drivers/net/usb/ipheth.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 964031e..9c98449 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -59,6 +59,7 @@
#define USB_PRODUCT_IPHONE_3G 0x1292
#define USB_PRODUCT_IPHONE_3GS 0x1294
#define USB_PRODUCT_IPHONE_4 0x1297
+#define USB_PRODUCT_IPAD 0x129a
#define USB_PRODUCT_IPHONE_4_VZW 0x129c
#define USB_PRODUCT_IPHONE_4S 0x12a0
@@ -101,6 +102,10 @@ static struct usb_device_id ipheth_table[] = {
IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
IPHETH_USBINTF_PROTO) },
{ USB_DEVICE_AND_INTERFACE_INFO(
+ USB_VENDOR_APPLE, USB_PRODUCT_IPAD,
+ IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
+ IPHETH_USBINTF_PROTO) },
+ { USB_DEVICE_AND_INTERFACE_INFO(
USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
IPHETH_USBINTF_PROTO) },
--
1.7.10.2
^ permalink raw reply related
* [PATCH net-next] net: Remove 'unlikely' qualifier in skb_steal_sock()
From: Vijay Subramanian @ 2012-06-24 23:03 UTC (permalink / raw)
To: netdev
Cc: davem, eric.dumazet, alexander.h.duyck, shemminger,
Vijay Subramanian
With early demux enabled by default for TCP flows, there is high chance that
skb->sk will be non-null. 'unlikely()' was removed from __inet_lookup_skb() but
maybe it can be removed from skb_steal_sock() as well.
Note: skb_steal_sock() is also called by __inet6_lookup_skb() and
__udp4_lib_lookup_skb() but they are protected by their own 'unlikely' calls.
Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
include/net/sock.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 87b424a..2108603 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2154,7 +2154,7 @@ static inline void sk_change_net(struct sock *sk, struct net *net)
static inline struct sock *skb_steal_sock(struct sk_buff *skb)
{
- if (unlikely(skb->sk)) {
+ if (skb->sk) {
struct sock *sk = skb->sk;
skb->destructor = NULL;
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH 1/1] ipheth: add support for iPad
From: Jesper Juhl @ 2012-06-25 0:09 UTC (permalink / raw)
To: rainbow; +Cc: Greg Kroah-Hartman, linux-usb, netdev, linux-kernel
In-Reply-To: <1340577468-3298-1-git-send-email-rainbow@irh.it>
On Mon, 25 Jun 2012, rainbow wrote:
> This adds support for the iPad to the ipheth driver.
> (product id = 0x129a)
>
> Signed-off-by: rainbow <rainbow@irh.it>
It is usually very much prefered that people use their real names in
Signed-off-by: lines.
Please consider re-submitting using your real name.
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply
* Re: [PATCH 1/1] ipheth: add support for iPad
From: David Miller @ 2012-06-25 2:53 UTC (permalink / raw)
To: jj; +Cc: rainbow, gregkh, linux-usb, netdev, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1206250208140.30361@swampdragon.chaosbits.net>
From: Jesper Juhl <jj@chaosbits.net>
Date: Mon, 25 Jun 2012 02:09:22 +0200 (CEST)
> On Mon, 25 Jun 2012, rainbow wrote:
>
>> This adds support for the iPad to the ipheth driver.
>> (product id = 0x129a)
>>
>> Signed-off-by: rainbow <rainbow@irh.it>
>
> It is usually very much prefered that people use their real names in
> Signed-off-by: lines.
>
> Please consider re-submitting using your real name.
Indeed.
^ permalink raw reply
* RE: [PATCH] r8169: RxConfig hack for the 8168evl.
From: hayeswang @ 2012-06-25 3:31 UTC (permalink / raw)
To: 'Francois Romieu'; +Cc: netdev, thomas.pi
In-Reply-To: <20120620220918.GA2785@electric-eye.fr.zoreil.com>
Hi,
> - the patch sets the RX_MULTI_EN bit. If the 8168c doc is any guide,
> the chipset now fetches several Rx descriptors at a time.
> - long ago the driver ignored the RX_MULTI_EN bit.
> e542a2269f232d61270ceddd42b73a4348dee2bb changed the RxConfig
> settings. Whatever the problem it's now labeled a regression.
The definition of the IO 0x44 bit 14 is opposite for new chips.
For 8111C, 0 means fetching one Rx descriptor, and 1 means fetching
multi-descriptors.
For 8111D and the later chips, 0 means fetching multi-descriptors, and 1 means
fetching one Rx descriptor.
However, I have no idea about why it influences the issue.
> - Realtek's own driver can identify two different 8168evl devices
> (CFG_METHOD_16 and CFG_METHOD_17) where the r8169 driver only
> sees one. It sucks.
The CFG_METHOD_16 is the internal test chip. We don't have mass production for
it. Even it could be removed from driver. I don't think the kernel have to
support it.
Best Regards,
Hayes
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2012-06-25 3:33 UTC (permalink / raw)
To: David Miller, netdev; +Cc: linux-next, linux-kernel, "Bjørn Mork"
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
Hi all,
Today's linux-next merge of the net-next tree got a conflict in
drivers/net/usb/qmi_wwan.c between commit b9f90eb27402 ("net: qmi_wwan:
fix Gobi device probing") from the net tree and various commits from the
net-next tree.
I am not sure how to fix this, but the comments in the net tree commit
implied that it would be placed in the 3.6 code, so I just used the
version of this file from the net-next tree.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH net] net: qmi_wwan: fix Oops while disconnecting
From: Ming Lei @ 2012-06-25 3:37 UTC (permalink / raw)
To: Bjørn Mork
Cc: Oliver Neukum, netdev, linux-usb, Marius Bjørnstad Kotsbak
In-Reply-To: <0e34226c-8fe7-4e2e-8fc2-2ed140f23e9b@email.android.com>
On Mon, Jun 25, 2012 at 1:47 AM, Bjørn Mork <bjorn@mork.no> wrote:
> Oliver Neukum <oliver@neukum.org> wrote:
>>Am Sonntag, 24. Juni 2012, 11:34:19 schrieb Bjørn Mork:
>>
>>> Sorry, I did not understand what you meant we should do here. The
>>extra
>>> usb_set_intfdata(, NULL) in usbnet_disconnect() won't make any
>>> difference for that piece of code, will it?
>>
>>The point is that if it may be set to NULL, we always want it to be set
>>to
>>NULL, so we catch bugs.
>>
>>> And the USB core ensures that intfdata is set to NULL before any
>>> reprobing, so that will never be a problem. That's the reason why it
>>> seems redundant setting it in usbnet_disconnect().
>>
>>The point is that if there is a problem because intfdata is set to
>>NULL,
>>there is very likely a problem in form of a race condition, if intfdata
>>were not set to NULL in usbnet's disconnect handler.
I don't agree on the assumption.
The current problem is caused by the set to NULL without any
protection or sync mechanism on it, and it is really a bug.
Also we didn't say the set to NULL will be cancelled, just delay
the clear until it is safe to do it, eg. after complete of unregister_netdev()
and driver_info->unbind, when the previous .open/.close has been
completed already or the later ones will notice the disconnection
early and won't touch usb_get_intfdata() any more.
> Thanks for explaining. Yes, that makes sense to me as well.
>
> So then the original patch against qmi_wwan should go in, and we should leave usbnet as it is. Are everyone comfortable with that?
I don't see any races caused by just removing usb_set_intfdata(, NULL)
or moving it after driver_info->unbind simply in usbnet_disconnect.
In fact, suppose that .open/.close and .disconnect are run on different CPUs,
there are no any guarantee that .open/.close can always see the clear action
immediately. Also, the clear of intfdata may not be observed in .manage_power
since usb_set_intfdata(, NULL) may be completed after the lock wdm_mutex
operation.
So it is only the sync mechanism that works on the race even the check is
added in the patch. Putting usb_set_intfdata(, NULL) after driver_info->unbind
should be OK, and it is a general solution for the problem.
Thanks,
--
Ming Lei
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2012-06-25 3:38 UTC (permalink / raw)
To: David Miller, netdev
Cc: linux-next, linux-kernel, Antonio Quartulli, Sven Eckelmann
[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]
Hi all,
Today's linux-next merge of the net-next tree got a conflict in
net/batman-adv/translation-table.c between commit 8b8e4bc0391f
("batman-adv: fix race condition in TT full-table replacement") from the
net tree and commit 7d211efc5087 ("batman-adv: Prefix originator
non-static functions with batadv_") from the net-next tree.
Just context changes. I fixed it up (see below) and can carry the fix as
necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc net/batman-adv/translation-table.c
index 2ab83d7,5180d50..0000000
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@@ -141,7 -139,8 +139,7 @@@ static void tt_orig_list_entry_free_rcu
struct tt_orig_list_entry *orig_entry;
orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu);
- orig_node_free_ref(orig_entry->orig_node);
- atomic_dec(&orig_entry->orig_node->tt_size);
+ batadv_orig_node_free_ref(orig_entry->orig_node);
kfree(orig_entry);
}
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH net-next 0/2] be2net fixes
From: Somnath Kotur @ 2012-06-25 5:38 UTC (permalink / raw)
To: netdev; +Cc: davem, Somnath Kotur
Pls apply.
Somnath Kotur (2):
be2net: Explicitly clear the reserved field in the Tx Descriptor
be2net: Regression bug wherein VFs creation broken for multiple
cards.
drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
1 files changed, 3 insertions(+), 1 deletions(-)
^ permalink raw reply
* [PATCH net-next 2/2] be2net: Regression bug wherein VFs creation broken for multiple cards.
From: Somnath Kotur @ 2012-06-25 5:42 UTC (permalink / raw)
To: netdev; +Cc: davem, Somnath Kotur
Fix be_find_vfs() to check for matching bus number as well along with devfn
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 21e0b5b..4836cc5 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1059,7 +1059,8 @@ static int be_find_vfs(struct be_adapter *adapter, int vf_state)
dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
while (dev) {
vf_fn = (pdev->devfn + offset + stride * vfs) & 0xFFFF;
- if (dev->is_virtfn && dev->devfn == vf_fn) {
+ if (dev->is_virtfn && dev->devfn == vf_fn &&
+ dev->bus->number == pdev->bus->number) {
vfs++;
if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
assigned_vfs++;
--
1.5.6.1
^ permalink raw reply related
* [PATCH net-next 1/2] be2net: Explicitly clear the reserved field in the Tx Descriptor
From: Somnath Kotur @ 2012-06-25 5:40 UTC (permalink / raw)
To: netdev; +Cc: davem, Somnath Kotur
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 5a34503..21e0b5b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -558,6 +558,7 @@ static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len)
wrb->frag_pa_hi = upper_32_bits(addr);
wrb->frag_pa_lo = addr & 0xFFFFFFFF;
wrb->frag_len = len & ETH_WRB_FRAG_LEN_MASK;
+ wrb->rsvd0 = 0;
}
static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter,
--
1.5.6.1
^ permalink raw reply related
* Re: [PATCH net-next] net: Remove 'unlikely' qualifier in skb_steal_sock()
From: Eric Dumazet @ 2012-06-25 6:09 UTC (permalink / raw)
To: Vijay Subramanian; +Cc: netdev, davem, alexander.h.duyck, shemminger
In-Reply-To: <1340578987-2495-1-git-send-email-subramanian.vijay@gmail.com>
On Sun, 2012-06-24 at 16:03 -0700, Vijay Subramanian wrote:
> With early demux enabled by default for TCP flows, there is high chance that
> skb->sk will be non-null. 'unlikely()' was removed from __inet_lookup_skb() but
> maybe it can be removed from skb_steal_sock() as well.
>
> Note: skb_steal_sock() is also called by __inet6_lookup_skb() and
> __udp4_lib_lookup_skb() but they are protected by their own 'unlikely' calls.
>
> Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: [PATCH net] net: qmi_wwan: fix Oops while disconnecting
From: Oliver Neukum @ 2012-06-25 6:15 UTC (permalink / raw)
To: Ming Lei
Cc: Bjørn Mork, netdev, linux-usb, Marius Bjørnstad Kotsbak
In-Reply-To: <CACVXFVN3wJ3NWxSGj-yWCgtDE_sgJT5CZYHwYUWk1MxkphcsTg@mail.gmail.com>
Am Montag, 25. Juni 2012, 05:37:20 schrieb Ming Lei:
> On Mon, Jun 25, 2012 at 1:47 AM, Bjørn Mork <bjorn@mork.no> wrote:
> > Oliver Neukum <oliver@neukum.org> wrote:
> >>Am Sonntag, 24. Juni 2012, 11:34:19 schrieb Bjørn Mork:
> >>
> >>> Sorry, I did not understand what you meant we should do here. The
> >>extra
> >>> usb_set_intfdata(, NULL) in usbnet_disconnect() won't make any
> >>> difference for that piece of code, will it?
> >>
> >>The point is that if it may be set to NULL, we always want it to be set
> >>to
> >>NULL, so we catch bugs.
> >>
> >>> And the USB core ensures that intfdata is set to NULL before any
> >>> reprobing, so that will never be a problem. That's the reason why it
> >>> seems redundant setting it in usbnet_disconnect().
> >>
> >>The point is that if there is a problem because intfdata is set to
> >>NULL,
> >>there is very likely a problem in form of a race condition, if intfdata
> >>were not set to NULL in usbnet's disconnect handler.
>
> I don't agree on the assumption.
>
> The current problem is caused by the set to NULL without any
> protection or sync mechanism on it, and it is really a bug.
Minidrivers can test for NULL.
That may not be enough and locking may be needed.
> Also we didn't say the set to NULL will be cancelled, just delay
> the clear until it is safe to do it, eg. after complete of unregister_netdev()
> and driver_info->unbind, when the previous .open/.close has been
> completed already or the later ones will notice the disconnection
> early and won't touch usb_get_intfdata() any more.
We can move to after unregister_netdev()
I am unhappy with it going after unbind.
> > Thanks for explaining. Yes, that makes sense to me as well.
> >
> > So then the original patch against qmi_wwan should go in, and we should leave usbnet as it is. Are everyone comfortable with that?
>
> I don't see any races caused by just removing usb_set_intfdata(, NULL)
> or moving it after driver_info->unbind simply in usbnet_disconnect.
They are not caused. They are harder to detect.
> In fact, suppose that .open/.close and .disconnect are run on different CPUs,
> there are no any guarantee that .open/.close can always see the clear action
> immediately. Also, the clear of intfdata may not be observed in .manage_power
> since usb_set_intfdata(, NULL) may be completed after the lock wdm_mutex
> operation.
Sure, it is a debugging aid. It has the drawback that minidrivers have
to be able to deal with intfdata being NULL. That is not hard to do.
Regards
Oliver
^ permalink raw reply
* [PATCH net-next] net: struct sock cleanups
From: Eric Dumazet @ 2012-06-25 6:22 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
Add missing kernel doc for sk_rx_dst
Move sk_rx_dst to avoid two 32bit holes on 64bit arches
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/sock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 87b424a..d9b558a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -198,6 +198,7 @@ struct cg_proto;
* @sk_lock: synchronizer
* @sk_rcvbuf: size of receive buffer in bytes
* @sk_wq: sock wait queue and async head
+ * @sk_rx_dst: receive input route used by early tcp demux
* @sk_dst_cache: destination cache
* @sk_dst_lock: destination cache lock
* @sk_policy: flow policy
@@ -317,9 +318,9 @@ struct sock {
struct xfrm_policy *sk_policy[2];
#endif
unsigned long sk_flags;
+ struct dst_entry *sk_rx_dst;
struct dst_entry *sk_dst_cache;
spinlock_t sk_dst_lock;
- struct dst_entry *sk_rx_dst;
atomic_t sk_wmem_alloc;
atomic_t sk_omem_alloc;
int sk_sndbuf;
^ permalink raw reply related
* Re: [PATCH v2 net-next] tcp: avoid tx starvation by SYNACK packets
From: Hans Schillstrom @ 2012-06-25 6:24 UTC (permalink / raw)
To: Eric Dumazet
Cc: Vijay Subramanian, Dave Taht, netdev, Neal Cardwell, Tom Herbert,
Jesper Dangaard Brouer
In-Reply-To: <1340440962.17495.39.camel@edumazet-glaptop>
Hi Eric
On Saturday 23 June 2012 10:42:42 Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> On Sat, 2012-06-23 at 00:34 -0700, Vijay Subramanian wrote:
>
> > This patch ([PATCH net-next] tcp: avoid tx starvation by SYNACK
> > packets) is neither in net/net-next trees nor on patchwork. Maybe it
> > was missed since it was sent during the merge window. Is this not
> > needed anymore or is it being tested currently?
>
> You're right, thanks for the reminder !
We have been runing this patch for a while now,
so I added a "Tested-by:"
>
> [PATCH v2 net-next] tcp: avoid tx starvation by SYNACK packets
>
> pfifo_fast being the default Qdisc, its pretty easy to fill it with
> SYNACK (small) packets while host is under synflood attack.
>
> Packets of established TCP sessions are dropped at Qdisc layer and
> host appears almost dead.
>
> Avoid this problem assigning TC_PRIO_FILLER priority to SYNACK
> generated in SYNCOOKIE mode, so that these packets are enqueued into
> pfifo_fast lowest priority (band 2).
>
> Other packets, queued to band 0 or 1 are dequeued before any SYNACK
> packets waiting in band 2.
>
> If not under synflood, SYNACK priority is as requested by listener
> sk_priority policy.
>
> Reported-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Tom Herbert <therbert@google.com>
> Cc: Vijay Subramanian <subramanian.vijay@gmail.com>
> ---
> net/dccp/ipv4.c | 2 ++
> net/ipv4/ip_output.c | 2 +-
> net/ipv4/tcp_ipv4.c | 7 ++++++-
> net/ipv6/inet6_connection_sock.c | 1 +
> net/ipv6/ip6_output.c | 2 +-
> net/ipv6/tcp_ipv6.c | 11 ++++++++---
> 6 files changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
> index 3eb76b5..045176f 100644
> --- a/net/dccp/ipv4.c
> +++ b/net/dccp/ipv4.c
> @@ -515,6 +515,7 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req,
>
> dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr,
> ireq->rmt_addr);
> + skb->priority = sk->sk_priority;
> err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
> ireq->rmt_addr,
> ireq->opt);
> @@ -556,6 +557,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
> skb_dst_set(skb, dst_clone(dst));
>
> bh_lock_sock(ctl_sk);
> + skb->priority = ctl_sk->sk_priority;
> err = ip_build_and_send_pkt(skb, ctl_sk,
> rxiph->daddr, rxiph->saddr, NULL);
> bh_unlock_sock(ctl_sk);
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 0f3185a..71c6c20 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -155,7 +155,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
> ip_options_build(skb, &opt->opt, daddr, rt, 0);
> }
>
> - skb->priority = sk->sk_priority;
> + /* skb->priority is set by the caller */
> skb->mark = sk->sk_mark;
>
> /* Send it out. */
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index b52934f..5ef4131 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -81,7 +81,7 @@
> #include <linux/stddef.h>
> #include <linux/proc_fs.h>
> #include <linux/seq_file.h>
> -
> +#include <linux/pkt_sched.h>
> #include <linux/crypto.h>
> #include <linux/scatterlist.h>
>
> @@ -821,6 +821,7 @@ static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
> * Send a SYN-ACK after having received a SYN.
> * This still operates on a request_sock only, not on a big
> * socket.
> + * nocache is set for SYN-ACK sent in SYNCOOKIE mode
> */
> static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
> struct request_sock *req,
> @@ -843,6 +844,10 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
> __tcp_v4_send_check(skb, ireq->loc_addr, ireq->rmt_addr);
>
> skb_set_queue_mapping(skb, queue_mapping);
> +
> + /* SYNACK sent in SYNCOOKIE mode have low priority */
> + skb->priority = nocache ? TC_PRIO_FILLER : sk->sk_priority;
> +
> err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
> ireq->rmt_addr,
> ireq->opt);
> diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
> index e6cee52..5812a74 100644
> --- a/net/ipv6/inet6_connection_sock.c
> +++ b/net/ipv6/inet6_connection_sock.c
> @@ -248,6 +248,7 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused)
> /* Restore final destination back after routing done */
> fl6.daddr = np->daddr;
>
> + skb->priority = sk->sk_priority;
> res = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
> rcu_read_unlock();
> return res;
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index a233a7c..a93378a 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -228,7 +228,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
> hdr->saddr = fl6->saddr;
> hdr->daddr = *first_hop;
>
> - skb->priority = sk->sk_priority;
> + /* skb->priority is set by the caller */
> skb->mark = sk->sk_mark;
>
> mtu = dst_mtu(dst);
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 26a8862..f664452 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -43,6 +43,7 @@
> #include <linux/ipv6.h>
> #include <linux/icmpv6.h>
> #include <linux/random.h>
> +#include <linux/pkt_sched.h>
>
> #include <net/tcp.h>
> #include <net/ndisc.h>
> @@ -479,7 +480,8 @@ out:
>
> static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
> struct request_values *rvp,
> - u16 queue_mapping)
> + u16 queue_mapping,
> + bool syncookie)
> {
> struct inet6_request_sock *treq = inet6_rsk(req);
> struct ipv6_pinfo *np = inet6_sk(sk);
> @@ -515,6 +517,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
> if (skb) {
> __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr);
>
> + skb->priority = syncookie ? TC_PRIO_FILLER : sk->sk_priority;
> fl6.daddr = treq->rmt_addr;
> skb_set_queue_mapping(skb, queue_mapping);
> err = ip6_xmit(sk, skb, &fl6, opt, np->tclass);
> @@ -531,7 +534,7 @@ static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req,
> struct request_values *rvp)
> {
> TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS);
> - return tcp_v6_send_synack(sk, req, rvp, 0);
> + return tcp_v6_send_synack(sk, req, rvp, 0, false);
> }
>
> static void tcp_v6_reqsk_destructor(struct request_sock *req)
> @@ -909,6 +912,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
> dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
> if (!IS_ERR(dst)) {
> skb_dst_set(buff, dst);
> + skb->priority = ctl_sk->sk_priority;
> ip6_xmit(ctl_sk, buff, &fl6, NULL, tclass);
> TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
> if (rst)
> @@ -1217,7 +1221,8 @@ have_isn:
>
> if (tcp_v6_send_synack(sk, req,
> (struct request_values *)&tmp_ext,
> - skb_get_queue_mapping(skb)) ||
> + skb_get_queue_mapping(skb),
> + want_cookie) ||
> want_cookie)
> goto drop_and_free;
>
>
>
>
--
Regards
Hans Schillstrom <hans.schillstrom@ericsson.com>
^ permalink raw reply
* Re: [PATCH 5/5] tcp: plug dst leak in tcp_v6_conn_request()
From: Eric Dumazet @ 2012-06-25 6:35 UTC (permalink / raw)
To: Neal Cardwell; +Cc: David Miller, netdev, Eric Dumazet, Tom Herbert
In-Reply-To: <CADVnQykuAQcj_i5cZQphKnnoHaCPMd6xLBmq1ZSAeZs83z3tfw@mail.gmail.com>
On Sun, 2012-06-24 at 13:12 -0400, Neal Cardwell wrote:
> http://patchwork.ozlabs.org/patch/166737/
>
> Yes, the patches in this series were generated as patches against the
> "net" tree (sorry for not indicating that).
>
> The dst leak on the v6 sysctl_tw_recycle code path (patches 2-5) seems
> like a pretty low priority, so I think we could simplify your plan
> even a little further... How about this as a plan: we could apply the
> first patch in the series (tcp: heed result of
> security_inet_conn_request() in tcp_v6_conn_request()) to the net tree
> now, and skip patches 2-5 for now. Once your pending synack work is in
> net-next, I can respin patches 2-5 for net-next. How does that sound?
>
It sounds good, thanks !
^ permalink raw reply
* pull request: batman-adv 2012-06-25
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
Hello David,
this is another set of changes intended for net-next/linux-3.6.
This patchset is entirely composed by "namespace renaming" patches.
Please, let me know if there is any problem.
Thank you,
Antonio
The following changes since commit 7011d0851b80a1a229acfda37ce08aad903b12d1:
tcp: Fix bug in tcp socket early demux (2012-06-23 23:22:38 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to a513088d022c8f59cebe17c567797c220563b517:
batman-adv: Prefix translation-table local static functions with batadv_ (2012-06-25 08:21:50 +0200)
----------------------------------------------------------------
Included changes:
- yet another batch of 'namespace cleaning' patches
----------------------------------------------------------------
Sven Eckelmann (20):
batman-adv: Prefix bat_debugfs local static functions with batadv_
batman-adv: Prefix bitarray static inline functions with batadv_
batman-adv: Prefix hard-interface static inline functions with batadv_
batman-adv: Prefix hash static inline functions with batadv_
batman-adv: Prefix originator static inline functions with batadv_
batman-adv: Prefix unicast static inline functions with batadv_
batman-adv: Prefix main static inline functions with batadv_
batman-adv: Prefix bat_iv_ogm local static functions with batadv_
batman-adv: Prefix bat_sysfs local static functions with batadv_
batman-adv: Prefix bridge_loop_avoidance local static functions with batadv_
batman-adv: Prefix gateway_client local static functions with batadv_
batman-adv: Prefix gateway_common local static functions with batadv_
batman-adv: Prefix hard-interface local static functions with batadv_
batman-adv: Prefix hash local static functions with batadv_
batman-adv: Prefix icmp_socket local static functions with batadv_
batman-adv: Prefix originator local static functions with batadv_
batman-adv: Prefix routing local static functions with batadv_
batman-adv: Prefix send local static functions with batadv_
batman-adv: Prefix soft-interface local static functions with batadv_
batman-adv: Prefix translation-table local static functions with batadv_
net/batman-adv/bat_debugfs.c | 143 +++---
net/batman-adv/bat_iv_ogm.c | 490 +++++++++++----------
net/batman-adv/bat_sysfs.c | 277 ++++++------
net/batman-adv/bitarray.c | 18 +-
net/batman-adv/bitarray.h | 6 +-
net/batman-adv/bridge_loop_avoidance.c | 518 +++++++++++-----------
net/batman-adv/gateway_client.c | 125 +++---
net/batman-adv/gateway_common.c | 10 +-
net/batman-adv/hard-interface.c | 96 +++--
net/batman-adv/hard-interface.h | 7 +-
net/batman-adv/hash.c | 4 +-
net/batman-adv/hash.h | 19 +-
net/batman-adv/icmp_socket.c | 84 ++--
net/batman-adv/main.c | 8 +-
net/batman-adv/main.h | 17 +-
net/batman-adv/originator.c | 128 +++---
net/batman-adv/originator.h | 10 +-
net/batman-adv/routing.c | 174 ++++----
net/batman-adv/send.c | 48 +--
net/batman-adv/soft-interface.c | 86 ++--
net/batman-adv/translation-table.c | 742 +++++++++++++++++---------------
net/batman-adv/unicast.c | 6 +-
net/batman-adv/unicast.h | 2 +-
net/batman-adv/vis.c | 53 +--
24 files changed, 1591 insertions(+), 1480 deletions(-)
^ permalink raw reply
* [PATCH 01/20] batman-adv: Prefix bat_debugfs local static functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1340607284-29950-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bat_debugfs.c | 143 +++++++++++++++++++++---------------------
1 file changed, 72 insertions(+), 71 deletions(-)
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 4001c57..03f09f0 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -32,25 +32,25 @@
#include "icmp_socket.h"
#include "bridge_loop_avoidance.h"
-static struct dentry *bat_debugfs;
+static struct dentry *batadv_debugfs;
#ifdef CONFIG_BATMAN_ADV_DEBUG
-#define LOG_BUFF_MASK (log_buff_len-1)
+#define LOG_BUFF_MASK (batadv_log_buff_len - 1)
#define LOG_BUFF(idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK])
-static int log_buff_len = LOG_BUF_LEN;
+static int batadv_log_buff_len = LOG_BUF_LEN;
-static void emit_log_char(struct debug_log *debug_log, char c)
+static void batadv_emit_log_char(struct debug_log *debug_log, char c)
{
LOG_BUFF(debug_log->log_end) = c;
debug_log->log_end++;
- if (debug_log->log_end - debug_log->log_start > log_buff_len)
- debug_log->log_start = debug_log->log_end - log_buff_len;
+ if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len)
+ debug_log->log_start = debug_log->log_end - batadv_log_buff_len;
}
__printf(2, 3)
-static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
+static int batadv_fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
{
va_list args;
static char debug_log_buf[256];
@@ -65,7 +65,7 @@ static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
va_end(args);
for (p = debug_log_buf; *p != 0; p++)
- emit_log_char(debug_log, *p);
+ batadv_emit_log_char(debug_log, *p);
spin_unlock_bh(&debug_log->lock);
@@ -81,14 +81,14 @@ int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
va_start(args, fmt);
vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
- fdebug_log(bat_priv->debug_log, "[%10u] %s",
- jiffies_to_msecs(jiffies), tmp_log_buf);
+ batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s",
+ jiffies_to_msecs(jiffies), tmp_log_buf);
va_end(args);
return 0;
}
-static int log_open(struct inode *inode, struct file *file)
+static int batadv_log_open(struct inode *inode, struct file *file)
{
nonseekable_open(inode, file);
file->private_data = inode->i_private;
@@ -96,14 +96,14 @@ static int log_open(struct inode *inode, struct file *file)
return 0;
}
-static int log_release(struct inode *inode, struct file *file)
+static int batadv_log_release(struct inode *inode, struct file *file)
{
batadv_dec_module_count();
return 0;
}
-static ssize_t log_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t batadv_log_read(struct file *file, char __user *buf,
+ size_t count, loff_t *ppos)
{
struct bat_priv *bat_priv = file->private_data;
struct debug_log *debug_log = bat_priv->debug_log;
@@ -156,7 +156,7 @@ static ssize_t log_read(struct file *file, char __user *buf,
return error;
}
-static unsigned int log_poll(struct file *file, poll_table *wait)
+static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
{
struct bat_priv *bat_priv = file->private_data;
struct debug_log *debug_log = bat_priv->debug_log;
@@ -169,15 +169,15 @@ static unsigned int log_poll(struct file *file, poll_table *wait)
return 0;
}
-static const struct file_operations log_fops = {
- .open = log_open,
- .release = log_release,
- .read = log_read,
- .poll = log_poll,
+static const struct file_operations batadv_log_fops = {
+ .open = batadv_log_open,
+ .release = batadv_log_release,
+ .read = batadv_log_read,
+ .poll = batadv_log_poll,
.llseek = no_llseek,
};
-static int debug_log_setup(struct bat_priv *bat_priv)
+static int batadv_debug_log_setup(struct bat_priv *bat_priv)
{
struct dentry *d;
@@ -192,7 +192,8 @@ static int debug_log_setup(struct bat_priv *bat_priv)
init_waitqueue_head(&bat_priv->debug_log->queue_wait);
d = debugfs_create_file("log", S_IFREG | S_IRUSR,
- bat_priv->debug_dir, bat_priv, &log_fops);
+ bat_priv->debug_dir, bat_priv,
+ &batadv_log_fops);
if (!d)
goto err;
@@ -202,49 +203,49 @@ err:
return -ENOMEM;
}
-static void debug_log_cleanup(struct bat_priv *bat_priv)
+static void batadv_debug_log_cleanup(struct bat_priv *bat_priv)
{
kfree(bat_priv->debug_log);
bat_priv->debug_log = NULL;
}
#else /* CONFIG_BATMAN_ADV_DEBUG */
-static int debug_log_setup(struct bat_priv *bat_priv)
+static int batadv_debug_log_setup(struct bat_priv *bat_priv)
{
bat_priv->debug_log = NULL;
return 0;
}
-static void debug_log_cleanup(struct bat_priv *bat_priv)
+static void batadv_debug_log_cleanup(struct bat_priv *bat_priv)
{
return;
}
#endif
-static int bat_algorithms_open(struct inode *inode, struct file *file)
+static int batadv_algorithms_open(struct inode *inode, struct file *file)
{
return single_open(file, batadv_algo_seq_print_text, NULL);
}
-static int originators_open(struct inode *inode, struct file *file)
+static int batadv_originators_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_orig_seq_print_text, net_dev);
}
-static int gateways_open(struct inode *inode, struct file *file)
+static int batadv_gateways_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_gw_client_seq_print_text, net_dev);
}
-static int transtable_global_open(struct inode *inode, struct file *file)
+static int batadv_transtable_global_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_tt_global_seq_print_text, net_dev);
}
#ifdef CONFIG_BATMAN_ADV_BLA
-static int bla_claim_table_open(struct inode *inode, struct file *file)
+static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_bla_claim_table_seq_print_text,
@@ -252,13 +253,13 @@ static int bla_claim_table_open(struct inode *inode, struct file *file)
}
#endif
-static int transtable_local_open(struct inode *inode, struct file *file)
+static int batadv_transtable_local_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_tt_local_seq_print_text, net_dev);
}
-static int vis_data_open(struct inode *inode, struct file *file)
+static int batadv_vis_data_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, batadv_vis_seq_print_text, net_dev);
@@ -269,37 +270,37 @@ struct bat_debuginfo {
const struct file_operations fops;
};
-#define BAT_DEBUGINFO(_name, _mode, _open) \
-struct bat_debuginfo bat_debuginfo_##_name = { \
- .attr = { .name = __stringify(_name), \
- .mode = _mode, }, \
- .fops = { .owner = THIS_MODULE, \
- .open = _open, \
- .read = seq_read, \
- .llseek = seq_lseek, \
- .release = single_release, \
- } \
+#define BAT_DEBUGINFO(_name, _mode, _open) \
+struct bat_debuginfo batadv_debuginfo_##_name = { \
+ .attr = { .name = __stringify(_name), \
+ .mode = _mode, }, \
+ .fops = { .owner = THIS_MODULE, \
+ .open = _open, \
+ .read = seq_read, \
+ .llseek = seq_lseek, \
+ .release = single_release, \
+ } \
};
-static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open);
-static BAT_DEBUGINFO(originators, S_IRUGO, originators_open);
-static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open);
-static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open);
+static BAT_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open);
+static BAT_DEBUGINFO(originators, S_IRUGO, batadv_originators_open);
+static BAT_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
+static BAT_DEBUGINFO(transtable_global, S_IRUGO, batadv_transtable_global_open);
#ifdef CONFIG_BATMAN_ADV_BLA
-static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open);
+static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
#endif
-static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open);
-static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open);
+static BAT_DEBUGINFO(transtable_local, S_IRUGO, batadv_transtable_local_open);
+static BAT_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);
-static struct bat_debuginfo *mesh_debuginfos[] = {
- &bat_debuginfo_originators,
- &bat_debuginfo_gateways,
- &bat_debuginfo_transtable_global,
+static struct bat_debuginfo *batadv_mesh_debuginfos[] = {
+ &batadv_debuginfo_originators,
+ &batadv_debuginfo_gateways,
+ &batadv_debuginfo_transtable_global,
#ifdef CONFIG_BATMAN_ADV_BLA
- &bat_debuginfo_bla_claim_table,
+ &batadv_debuginfo_bla_claim_table,
#endif
- &bat_debuginfo_transtable_local,
- &bat_debuginfo_vis_data,
+ &batadv_debuginfo_transtable_local,
+ &batadv_debuginfo_vis_data,
NULL,
};
@@ -308,17 +309,17 @@ void batadv_debugfs_init(void)
struct bat_debuginfo *bat_debug;
struct dentry *file;
- bat_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL);
- if (bat_debugfs == ERR_PTR(-ENODEV))
- bat_debugfs = NULL;
+ batadv_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL);
+ if (batadv_debugfs == ERR_PTR(-ENODEV))
+ batadv_debugfs = NULL;
- if (!bat_debugfs)
+ if (!batadv_debugfs)
goto out;
- bat_debug = &bat_debuginfo_routing_algos;
+ bat_debug = &batadv_debuginfo_routing_algos;
file = debugfs_create_file(bat_debug->attr.name,
S_IFREG | bat_debug->attr.mode,
- bat_debugfs, NULL, &bat_debug->fops);
+ batadv_debugfs, NULL, &bat_debug->fops);
if (!file)
pr_err("Can't add debugfs file: %s\n", bat_debug->attr.name);
@@ -328,9 +329,9 @@ out:
void batadv_debugfs_destroy(void)
{
- if (bat_debugfs) {
- debugfs_remove_recursive(bat_debugfs);
- bat_debugfs = NULL;
+ if (batadv_debugfs) {
+ debugfs_remove_recursive(batadv_debugfs);
+ batadv_debugfs = NULL;
}
}
@@ -340,20 +341,20 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
struct bat_debuginfo **bat_debug;
struct dentry *file;
- if (!bat_debugfs)
+ if (!batadv_debugfs)
goto out;
- bat_priv->debug_dir = debugfs_create_dir(dev->name, bat_debugfs);
+ bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs);
if (!bat_priv->debug_dir)
goto out;
if (batadv_socket_setup(bat_priv) < 0)
goto rem_attr;
- if (debug_log_setup(bat_priv) < 0)
+ if (batadv_debug_log_setup(bat_priv) < 0)
goto rem_attr;
- for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) {
+ for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) {
file = debugfs_create_file(((*bat_debug)->attr).name,
S_IFREG | ((*bat_debug)->attr).mode,
bat_priv->debug_dir,
@@ -381,9 +382,9 @@ void batadv_debugfs_del_meshif(struct net_device *dev)
{
struct bat_priv *bat_priv = netdev_priv(dev);
- debug_log_cleanup(bat_priv);
+ batadv_debug_log_cleanup(bat_priv);
- if (bat_debugfs) {
+ if (batadv_debugfs) {
debugfs_remove_recursive(bat_priv->debug_dir);
bat_priv->debug_dir = NULL;
}
--
1.7.9.4
^ permalink raw reply related
* [PATCH 02/20] batman-adv: Prefix bitarray static inline functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1340607284-29950-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bat_iv_ogm.c | 13 +++++++------
net/batman-adv/bitarray.c | 8 ++++----
net/batman-adv/bitarray.h | 6 +++---
net/batman-adv/routing.c | 4 ++--
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 94859d4..ad641e8 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -901,9 +901,9 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
hlist_for_each_entry_rcu(tmp_neigh_node, node,
&orig_node->neigh_list, list) {
- is_duplicate |= bat_test_bit(tmp_neigh_node->real_bits,
- orig_node->last_real_seqno,
- seqno);
+ is_duplicate |= batadv_test_bit(tmp_neigh_node->real_bits,
+ orig_node->last_real_seqno,
+ seqno);
if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) &&
(tmp_neigh_node->if_incoming == if_incoming))
@@ -1037,6 +1037,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
if (is_my_orig) {
unsigned long *word;
int offset;
+ int32_t bit_pos;
orig_neigh_node = batadv_get_orig_node(bat_priv,
ethhdr->h_source);
@@ -1054,9 +1055,9 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
word = &(orig_neigh_node->bcast_own[offset]);
- bat_set_bit(word,
- if_incoming_seqno -
- ntohl(batman_ogm_packet->seqno) - 2);
+ bit_pos = if_incoming_seqno - 2;
+ bit_pos -= ntohl(batman_ogm_packet->seqno);
+ batadv_set_bit(word, bit_pos);
orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
bitmap_weight(word, TQ_LOCAL_WINDOW_SIZE);
spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c
index 838abbc..7a7065c 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -48,7 +48,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
*/
if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) {
if (set_mark)
- bat_set_bit(seq_bits, -seq_num_diff);
+ batadv_set_bit(seq_bits, -seq_num_diff);
return 0;
}
@@ -59,7 +59,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
batadv_bitmap_shift_left(seq_bits, seq_num_diff);
if (set_mark)
- bat_set_bit(seq_bits, 0);
+ batadv_set_bit(seq_bits, 0);
return 1;
}
@@ -71,7 +71,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
seq_num_diff - 1);
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
- bat_set_bit(seq_bits, 0);
+ batadv_set_bit(seq_bits, 0);
return 1;
}
@@ -88,7 +88,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
- bat_set_bit(seq_bits, 0);
+ batadv_set_bit(seq_bits, 0);
return 1;
}
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h
index 8ab5426..7954ba8 100644
--- a/net/batman-adv/bitarray.h
+++ b/net/batman-adv/bitarray.h
@@ -23,8 +23,8 @@
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno
*/
-static inline int bat_test_bit(const unsigned long *seq_bits,
- uint32_t last_seqno, uint32_t curr_seqno)
+static inline int batadv_test_bit(const unsigned long *seq_bits,
+ uint32_t last_seqno, uint32_t curr_seqno)
{
int32_t diff;
@@ -36,7 +36,7 @@ static inline int bat_test_bit(const unsigned long *seq_bits,
}
/* turn corresponding bit on, so we can remember that we got the packet */
-static inline void bat_set_bit(unsigned long *seq_bits, int32_t n)
+static inline void batadv_set_bit(unsigned long *seq_bits, int32_t n)
{
/* if too old, just drop it */
if (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 79f63cf..9c90cce 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1086,8 +1086,8 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
spin_lock_bh(&orig_node->bcast_seqno_lock);
/* check whether the packet is a duplicate */
- if (bat_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno,
- ntohl(bcast_packet->seqno)))
+ if (batadv_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno,
+ ntohl(bcast_packet->seqno)))
goto spin_unlock;
seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno;
--
1.7.9.4
^ permalink raw reply related
* [PATCH 03/20] batman-adv: Prefix hard-interface static inline functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1340607284-29950-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bat_iv_ogm.c | 14 +++++++-------
net/batman-adv/bat_sysfs.c | 16 ++++++++--------
net/batman-adv/bridge_loop_avoidance.c | 28 ++++++++++++++--------------
net/batman-adv/gateway_client.c | 4 ++--
net/batman-adv/hard-interface.c | 28 ++++++++++++++--------------
net/batman-adv/hard-interface.h | 7 ++++---
net/batman-adv/icmp_socket.c | 4 ++--
net/batman-adv/originator.c | 4 ++--
net/batman-adv/routing.c | 12 ++++++------
net/batman-adv/send.c | 6 +++---
net/batman-adv/soft-interface.c | 4 ++--
net/batman-adv/translation-table.c | 28 ++++++++++++++--------------
net/batman-adv/unicast.c | 4 ++--
net/batman-adv/vis.c | 8 ++++----
14 files changed, 84 insertions(+), 83 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index ad641e8..94e6fdb 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -232,7 +232,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
if (forw_packet->if_incoming->if_status != IF_ACTIVE)
goto out;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -273,7 +273,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
/* return true if new_packet can be aggregated with forw_packet */
@@ -311,7 +311,7 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
* a "global" packet as well as the base
* packet
*/
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -352,7 +352,7 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return res;
}
@@ -431,7 +431,7 @@ static void bat_iv_ogm_aggregate_new(const unsigned char *packet_buff,
return;
out:
- hardif_free_ref(if_incoming);
+ batadv_hardif_free_ref(if_incoming);
}
/* aggregate a new packet into the existing ogm packet */
@@ -570,7 +570,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
int vis_server, tt_num_changes = 0;
vis_server = atomic_read(&bat_priv->vis_mode);
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (hard_iface == primary_if)
tt_num_changes = batadv_tt_append_diff(bat_priv,
@@ -608,7 +608,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
bat_iv_ogm_emit_send_time(bat_priv));
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 8196fa6..0c7e22e 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -132,7 +132,7 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
length = __store_uint_attr(buff, count, _min, _max, _post_func, \
attr, &hard_iface->_name, net_dev); \
\
- hardif_free_ref(hard_iface); \
+ batadv_hardif_free_ref(hard_iface); \
return length; \
}
@@ -150,7 +150,7 @@ ssize_t show_##_name(struct kobject *kobj, \
\
length = sprintf(buff, "%i\n", atomic_read(&hard_iface->_name));\
\
- hardif_free_ref(hard_iface); \
+ batadv_hardif_free_ref(hard_iface); \
return length; \
}
@@ -535,7 +535,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
"none" : hard_iface->soft_iface->name);
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
return length;
}
@@ -557,7 +557,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
if (strlen(buff) >= IFNAMSIZ) {
pr_err("Invalid parameter for 'mesh_iface' setting received: interface name too long '%s'\n",
buff);
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
return -EINVAL;
}
@@ -592,7 +592,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
unlock:
rtnl_unlock();
out:
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
return ret;
}
@@ -625,7 +625,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
break;
}
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
return length;
}
@@ -688,7 +688,7 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
struct kobject *bat_kobj;
char *uevent_env[4] = { NULL, NULL, NULL, NULL };
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -727,7 +727,7 @@ out:
kfree(uevent_env[2]);
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (ret)
bat_dbg(DBG_BATMAN, bat_priv,
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 52c0d63..72ff8b9 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -255,7 +255,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
struct bla_claim_dst local_claim_dest;
__be32 zeroip = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
return;
@@ -339,7 +339,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
netif_rx(skb);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
/* @bat_priv: the bat priv with all the soft interface information
@@ -1075,7 +1075,7 @@ static void bla_periodic_work(struct work_struct *work)
struct hard_iface *primary_if;
int i;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -1106,7 +1106,7 @@ static void bla_periodic_work(struct work_struct *work)
}
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
bla_start_timer(bat_priv);
}
@@ -1131,12 +1131,12 @@ int batadv_bla_init(struct bat_priv *bat_priv)
/* setting claim destination address */
memcpy(&bat_priv->claim_dest.magic, claim_dest, 3);
bat_priv->claim_dest.type = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (primary_if) {
bat_priv->claim_dest.group =
htons(crc16(0, primary_if->net_dev->dev_addr,
ETH_ALEN));
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
} else {
bat_priv->claim_dest.group = 0; /* will be set later */
}
@@ -1319,7 +1319,7 @@ void batadv_bla_free(struct bat_priv *bat_priv)
struct hard_iface *primary_if;
cancel_delayed_work_sync(&bat_priv->bla_work);
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (bat_priv->claim_hash) {
bla_purge_claims(bat_priv, primary_if, 1);
@@ -1332,7 +1332,7 @@ void batadv_bla_free(struct bat_priv *bat_priv)
bat_priv->backbone_hash = NULL;
}
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
/* @bat_priv: the bat priv with all the soft interface information
@@ -1356,7 +1356,7 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
ethhdr = (struct ethhdr *)skb_mac_header(skb);
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto handled;
@@ -1416,7 +1416,7 @@ handled:
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (claim)
claim_free_ref(claim);
return ret;
@@ -1441,7 +1441,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
struct hard_iface *primary_if;
int ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -1502,7 +1502,7 @@ handled:
ret = 1;
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (claim)
claim_free_ref(claim);
return ret;
@@ -1521,7 +1521,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
bool is_own;
int ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -1559,6 +1559,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
}
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 0d90fff..c917a2e 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -464,7 +464,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
struct hlist_node *node;
int gw_count = 0, ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -503,7 +503,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 2a4d394..06f8d63 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -102,7 +102,7 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
struct vis_packet *vis_packet;
struct hard_iface *primary_if;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -115,7 +115,7 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
static void primary_if_select(struct bat_priv *bat_priv,
@@ -139,7 +139,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
out:
if (curr_hard_iface)
- hardif_free_ref(curr_hard_iface);
+ batadv_hardif_free_ref(curr_hard_iface);
}
static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
@@ -229,7 +229,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
/* the first active interface becomes our primary interface or
* the next active interface after the old primary interface was removed
*/
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
primary_if_select(bat_priv, hard_iface);
@@ -240,7 +240,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
static void hardif_deactivate_interface(struct hard_iface *hard_iface)
@@ -347,7 +347,7 @@ out:
err_dev:
dev_put(soft_iface);
err:
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
return ret;
}
@@ -369,7 +369,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
bat_priv->num_ifaces--;
batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (hard_iface == primary_if) {
struct hard_iface *new_if;
@@ -377,7 +377,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
primary_if_select(bat_priv, new_if);
if (new_if)
- hardif_free_ref(new_if);
+ batadv_hardif_free_ref(new_if);
}
bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
@@ -393,11 +393,11 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
batadv_softif_destroy(hard_iface->soft_iface);
hard_iface->soft_iface = NULL;
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
@@ -461,7 +461,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
hard_iface->if_status = IF_TO_BE_REMOVED;
batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
}
void batadv_hardif_remove_interfaces(void)
@@ -517,7 +517,7 @@ static int hard_if_event(struct notifier_block *this,
bat_priv = netdev_priv(hard_iface->soft_iface);
bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto hardif_put;
@@ -529,10 +529,10 @@ static int hard_if_event(struct notifier_block *this,
}
hardif_put:
- hardif_free_ref(hard_iface);
+ batadv_hardif_free_ref(hard_iface);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return NOTIFY_DONE;
}
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index 6bc12c0..d66dabd 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -42,14 +42,15 @@ void batadv_update_min_mtu(struct net_device *soft_iface);
void batadv_hardif_free_rcu(struct rcu_head *rcu);
bool batadv_is_wifi_iface(int ifindex);
-static inline void hardif_free_ref(struct hard_iface *hard_iface)
+static inline void
+batadv_hardif_free_ref(struct hard_iface *hard_iface)
{
if (atomic_dec_and_test(&hard_iface->refcount))
call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu);
}
-static inline struct hard_iface *primary_if_get_selected(
- struct bat_priv *bat_priv)
+static inline struct hard_iface *
+batadv_primary_if_get_selected(struct bat_priv *bat_priv)
{
struct hard_iface *hard_iface;
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 40c5e18..2523436 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -163,7 +163,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
return -EINVAL;
}
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
len = -EFAULT;
@@ -244,7 +244,7 @@ free_skb:
kfree_skb(skb);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (orig_node)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 86e7e08..90d24fc 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -412,7 +412,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
uint32_t i;
int ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
@@ -479,7 +479,7 @@ next:
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 9c90cce..9c6edc2 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -292,7 +292,7 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
goto out;
}
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -322,7 +322,7 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (router)
batadv_neigh_node_free_ref(router);
if (orig_node)
@@ -348,7 +348,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
goto out;
}
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -377,7 +377,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (router)
batadv_neigh_node_free_ref(router);
if (orig_node)
@@ -955,12 +955,12 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
if (!orig_node) {
if (!batadv_is_my_client(bat_priv, ethhdr->h_dest))
return 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
return 0;
memcpy(unicast_packet->dest,
primary_if->net_dev->dev_addr, ETH_ALEN);
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
} else {
memcpy(unicast_packet->dest, orig_node->orig,
ETH_ALEN);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 2c92a32..54091db 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -101,7 +101,7 @@ static void forw_packet_free(struct forw_packet *forw_packet)
if (forw_packet->skb)
kfree_skb(forw_packet->skb);
if (forw_packet->if_incoming)
- hardif_free_ref(forw_packet->if_incoming);
+ batadv_hardif_free_ref(forw_packet->if_incoming);
kfree(forw_packet);
}
@@ -146,7 +146,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
goto out;
}
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out_and_inc;
@@ -180,7 +180,7 @@ out_and_inc:
atomic_inc(&bat_priv->bcast_queue_left);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return NETDEV_TX_BUSY;
}
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0658781..85fe9c1 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -199,7 +199,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
/* ethernet packet should be broadcasted */
if (do_bcast) {
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto dropped;
@@ -253,7 +253,7 @@ dropped_freed:
bat_priv->stats.tx_dropped++;
end:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return NETDEV_TX_OK;
}
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 5180d50..bc06af4 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -298,7 +298,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
struct hard_iface *primary_if;
int req_len;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
req_len = min_packet_len;
req_len += batadv_tt_len(atomic_read(&bat_priv->tt_local_changes));
@@ -313,7 +313,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
min_packet_len, req_len);
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
static int tt_changes_fill_buff(struct bat_priv *bat_priv,
@@ -381,7 +381,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
uint32_t i;
int ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -423,7 +423,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
}
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
@@ -727,7 +727,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
uint32_t i;
int ret = 0;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -763,7 +763,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
}
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
@@ -1370,7 +1370,7 @@ static int send_tt_request(struct bat_priv *bat_priv,
struct tt_req_node *tt_req_node = NULL;
int ret = 1;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -1420,7 +1420,7 @@ out:
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (ret)
kfree_skb(skb);
if (ret && tt_req_node) {
@@ -1464,7 +1464,7 @@ static bool send_other_tt_response(struct bat_priv *bat_priv,
if (!neigh_node)
goto out;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -1555,7 +1555,7 @@ out:
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (!ret)
kfree_skb(skb);
return ret;
@@ -1592,7 +1592,7 @@ static bool send_my_tt_response(struct bat_priv *bat_priv,
if (!neigh_node)
goto out;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -1672,7 +1672,7 @@ out:
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
if (!ret)
kfree_skb(skb);
/* This packet was for me, so it doesn't need to be re-routed */
@@ -1956,11 +1956,11 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
roam_adv_packet->header.packet_type = BAT_ROAM_ADV;
roam_adv_packet->header.version = COMPAT_VERSION;
roam_adv_packet->header.ttl = TTL;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
memcpy(roam_adv_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN);
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
memcpy(roam_adv_packet->dst, orig_node->orig, ETH_ALEN);
memcpy(roam_adv_packet->client, client, ETH_ALEN);
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index b2b76df..fff34e0 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -227,7 +227,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
int large_tail = 0, ret = NET_RX_DROP;
uint16_t seqno;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto dropped;
@@ -277,7 +277,7 @@ dropped:
kfree_skb(skb);
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 20eef04..619f0a5 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -208,7 +208,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
size_t buff_pos, buf_size;
char *buff;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -329,7 +329,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
return ret;
}
@@ -828,7 +828,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
struct hard_iface *primary_if;
struct vis_packet *packet;
- primary_if = primary_if_get_selected(bat_priv);
+ primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
@@ -849,7 +849,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
out:
if (primary_if)
- hardif_free_ref(primary_if);
+ batadv_hardif_free_ref(primary_if);
}
/* called from timer; send (and maybe generate) vis packet. */
--
1.7.9.4
^ permalink raw reply related
* [PATCH 04/20] batman-adv: Prefix hash static inline functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1340607284-29950-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bridge_loop_avoidance.c | 13 ++++++++-----
net/batman-adv/hash.h | 19 ++++++++++---------
net/batman-adv/originator.c | 5 +++--
net/batman-adv/translation-table.c | 24 +++++++++++++-----------
net/batman-adv/vis.c | 16 ++++++++--------
5 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 72ff8b9..7a2dfd4 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -379,8 +379,9 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
/* one for the hash, one for returning */
atomic_set(&entry->refcount, 2);
- hash_added = hash_add(bat_priv->backbone_hash, compare_backbone_gw,
- choose_backbone_gw, entry, &entry->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->backbone_hash,
+ compare_backbone_gw, choose_backbone_gw,
+ entry, &entry->hash_entry);
if (unlikely(hash_added != 0)) {
/* hash failed, free the structure */
@@ -540,8 +541,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
bat_dbg(DBG_BLA, bat_priv,
"bla_add_claim(): adding new entry %pM, vid %d to hash ...\n",
mac, vid);
- hash_added = hash_add(bat_priv->claim_hash, compare_claim,
- choose_claim, claim, &claim->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->claim_hash,
+ compare_claim, choose_claim,
+ claim, &claim->hash_entry);
if (unlikely(hash_added != 0)) {
/* only local changes happened. */
@@ -590,7 +592,8 @@ static void bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac,
bat_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, vid);
- hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, claim);
+ batadv_hash_remove(bat_priv->claim_hash, compare_claim, choose_claim,
+ claim);
claim_free_ref(claim); /* reference from the hash is gone */
claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h
index eba8f2a..7ec4e5b 100644
--- a/net/batman-adv/hash.h
+++ b/net/batman-adv/hash.h
@@ -54,8 +54,8 @@ void batadv_hash_destroy(struct hashtable_t *hash);
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked.
*/
-static inline void hash_delete(struct hashtable_t *hash,
- hashdata_free_cb free_cb, void *arg)
+static inline void batadv_hash_delete(struct hashtable_t *hash,
+ hashdata_free_cb free_cb, void *arg)
{
struct hlist_head *head;
struct hlist_node *node, *node_tmp;
@@ -89,10 +89,11 @@ static inline void hash_delete(struct hashtable_t *hash,
* Returns 0 on success, 1 if the element already is in the hash
* and -1 on error.
*/
-static inline int hash_add(struct hashtable_t *hash,
- hashdata_compare_cb compare,
- hashdata_choose_cb choose,
- const void *data, struct hlist_node *data_node)
+static inline int batadv_hash_add(struct hashtable_t *hash,
+ hashdata_compare_cb compare,
+ hashdata_choose_cb choose,
+ const void *data,
+ struct hlist_node *data_node)
{
uint32_t index;
int ret = -1;
@@ -133,9 +134,9 @@ out:
* structure you use with just the key filled, we just need the key for
* comparing.
*/
-static inline void *hash_remove(struct hashtable_t *hash,
- hashdata_compare_cb compare,
- hashdata_choose_cb choose, void *data)
+static inline void *batadv_hash_remove(struct hashtable_t *hash,
+ hashdata_compare_cb compare,
+ hashdata_choose_cb choose, void *data)
{
uint32_t index;
struct hlist_node *node;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 90d24fc..623c23c 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -248,8 +248,9 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
if (!orig_node->bcast_own_sum)
goto free_bcast_own;
- hash_added = hash_add(bat_priv->orig_hash, compare_orig,
- choose_orig, orig_node, &orig_node->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->orig_hash, compare_orig,
+ choose_orig, orig_node,
+ &orig_node->hash_entry);
if (hash_added != 0)
goto free_bcast_own_sum;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index bc06af4..72a8548 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -234,9 +234,9 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
*/
tt_local_entry->common.flags |= TT_CLIENT_NEW;
- hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig,
- &tt_local_entry->common,
- &tt_local_entry->common.hash_entry);
+ hash_added = batadv_hash_add(bat_priv->tt_local_hash, compare_tt,
+ choose_orig, &tt_local_entry->common,
+ &tt_local_entry->common.hash_entry);
if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
@@ -618,6 +618,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct tt_global_entry *tt_global_entry = NULL;
int ret = 0;
int hash_added;
+ struct tt_common_entry *common;
tt_global_entry = tt_global_hash_find(bat_priv, tt_addr);
@@ -627,18 +628,19 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
if (!tt_global_entry)
goto out;
- memcpy(tt_global_entry->common.addr, tt_addr, ETH_ALEN);
+ common = &tt_global_entry->common;
+ memcpy(common->addr, tt_addr, ETH_ALEN);
- tt_global_entry->common.flags = NO_FLAGS;
+ common->flags = NO_FLAGS;
tt_global_entry->roam_at = 0;
- atomic_set(&tt_global_entry->common.refcount, 2);
+ atomic_set(&common->refcount, 2);
INIT_HLIST_HEAD(&tt_global_entry->orig_list);
spin_lock_init(&tt_global_entry->list_lock);
- hash_added = hash_add(bat_priv->tt_global_hash, compare_tt,
- choose_orig, &tt_global_entry->common,
- &tt_global_entry->common.hash_entry);
+ hash_added = batadv_hash_add(bat_priv->tt_global_hash,
+ compare_tt, choose_orig,
+ common, &common->hash_entry);
if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
@@ -816,8 +818,8 @@ static void tt_global_del_struct(struct bat_priv *bat_priv,
"Deleting global tt entry %pM: %s\n",
tt_global_entry->common.addr, message);
- hash_remove(bat_priv->tt_global_hash, compare_tt, choose_orig,
- tt_global_entry->common.addr);
+ batadv_hash_remove(bat_priv->tt_global_hash, compare_tt, choose_orig,
+ tt_global_entry->common.addr);
tt_global_entry_free_ref(tt_global_entry);
}
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 619f0a5..e0a9057 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -433,8 +433,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
}
}
/* remove old entry */
- hash_remove(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
- old_info);
+ batadv_hash_remove(bat_priv->vis_hash, vis_info_cmp,
+ vis_info_choose, old_info);
send_list_del(old_info);
kref_put(&old_info->refcount, free_info);
}
@@ -474,8 +474,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
recv_list_add(bat_priv, &info->recv_list, packet->sender_orig);
/* try to add it */
- hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
- info, &info->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
+ vis_info_choose, info, &info->hash_entry);
if (hash_added != 0) {
/* did not work (for some reason) */
kref_put(&info->refcount, free_info);
@@ -934,9 +934,9 @@ int batadv_vis_init(struct bat_priv *bat_priv)
INIT_LIST_HEAD(&bat_priv->vis_send_list);
- hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
- bat_priv->my_vis_info,
- &bat_priv->my_vis_info->hash_entry);
+ hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
+ vis_info_choose, bat_priv->my_vis_info,
+ &bat_priv->my_vis_info->hash_entry);
if (hash_added != 0) {
pr_err("Can't add own vis packet into hash\n");
/* not in hash, need to remove it manually. */
@@ -977,7 +977,7 @@ void batadv_vis_quit(struct bat_priv *bat_priv)
spin_lock_bh(&bat_priv->vis_hash_lock);
/* properly remove, kill timers ... */
- hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
+ batadv_hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
bat_priv->vis_hash = NULL;
bat_priv->my_vis_info = NULL;
spin_unlock_bh(&bat_priv->vis_hash_lock);
--
1.7.9.4
^ permalink raw reply related
* [PATCH 05/20] batman-adv: Prefix originator static inline functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1340607284-29950-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bridge_loop_avoidance.c | 4 ++--
net/batman-adv/icmp_socket.c | 2 +-
net/batman-adv/originator.c | 4 ++--
net/batman-adv/originator.h | 8 ++++----
net/batman-adv/routing.c | 26 +++++++++++++++-----------
net/batman-adv/translation-table.c | 21 +++++++++++----------
net/batman-adv/unicast.c | 2 +-
net/batman-adv/vis.c | 2 +-
8 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 7a2dfd4..1d143d5 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -390,7 +390,7 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
}
/* this is a gateway now, remove any tt entries */
- orig_node = orig_hash_find(bat_priv, orig);
+ orig_node = batadv_orig_hash_find(bat_priv, orig);
if (orig_node) {
batadv_tt_global_del_orig(bat_priv, orig_node,
"became a backbone gateway");
@@ -780,7 +780,7 @@ static int check_claim_group(struct bat_priv *bat_priv,
return 2;
/* lets see if this originator is in our mesh */
- orig_node = orig_hash_find(bat_priv, backbone_addr);
+ orig_node = batadv_orig_hash_find(bat_priv, backbone_addr);
/* dont accept claims from gateways which are not in
* the same mesh or group.
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 2523436..50a74da 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -213,7 +213,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
goto dst_unreach;
- orig_node = orig_hash_find(bat_priv, icmp_packet->dst);
+ orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->dst);
if (!orig_node)
goto dst_unreach;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 623c23c..36f5ee5 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -195,7 +195,7 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
int size;
int hash_added;
- orig_node = orig_hash_find(bat_priv, addr);
+ orig_node = batadv_orig_hash_find(bat_priv, addr);
if (orig_node)
return orig_node;
@@ -249,7 +249,7 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
goto free_bcast_own;
hash_added = batadv_hash_add(bat_priv->orig_hash, compare_orig,
- choose_orig, orig_node,
+ batadv_choose_orig, orig_node,
&orig_node->hash_entry);
if (hash_added != 0)
goto free_bcast_own_sum;
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index a721719..c4f63b4 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -41,7 +41,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num);
/* hashfunction to choose an entry in a hash table of given size
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/
-static inline uint32_t choose_orig(const void *data, uint32_t size)
+static inline uint32_t batadv_choose_orig(const void *data, uint32_t size)
{
const unsigned char *key = data;
uint32_t hash = 0;
@@ -60,8 +60,8 @@ static inline uint32_t choose_orig(const void *data, uint32_t size)
return hash % size;
}
-static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv,
- const void *data)
+static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv,
+ const void *data)
{
struct hashtable_t *hash = bat_priv->orig_hash;
struct hlist_head *head;
@@ -72,7 +72,7 @@ static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv,
if (!hash)
return NULL;
- index = choose_orig(data, hash->size);
+ index = batadv_choose_orig(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 9c6edc2..0888f1e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -298,7 +298,7 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
/* answer echo request (ping) */
/* get routing information */
- orig_node = orig_hash_find(bat_priv, icmp_packet->orig);
+ orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->orig);
if (!orig_node)
goto out;
@@ -353,7 +353,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
goto out;
/* get routing information */
- orig_node = orig_hash_find(bat_priv, icmp_packet->orig);
+ orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->orig);
if (!orig_node)
goto out;
@@ -437,7 +437,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return recv_icmp_ttl_exceeded(bat_priv, skb);
/* get routing information */
- orig_node = orig_hash_find(bat_priv, icmp_packet->dst);
+ orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->dst);
if (!orig_node)
goto out;
@@ -684,7 +684,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
if (batadv_bla_is_backbone_gw_orig(bat_priv, roam_adv_packet->src))
goto out;
- orig_node = orig_hash_find(bat_priv, roam_adv_packet->src);
+ orig_node = batadv_orig_hash_find(bat_priv, roam_adv_packet->src);
if (!orig_node)
goto out;
@@ -721,6 +721,7 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
struct neigh_node *router;
static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
int bonding_enabled;
+ uint8_t *primary_addr;
if (!orig_node)
return NULL;
@@ -743,20 +744,22 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
if ((!recv_if) && (!bonding_enabled))
goto return_router;
+ primary_addr = router_orig->primary_addr;
+
/* if we have something in the primary_addr, we can search
* for a potential bonding candidate.
*/
- if (compare_eth(router_orig->primary_addr, zero_mac))
+ if (compare_eth(primary_addr, zero_mac))
goto return_router;
/* find the orig_node which has the primary interface. might
* even be the same as our router_orig in many cases
*/
- if (compare_eth(router_orig->primary_addr, router_orig->orig)) {
+ if (compare_eth(primary_addr, router_orig->orig)) {
primary_orig_node = router_orig;
} else {
- primary_orig_node = orig_hash_find(bat_priv,
- router_orig->primary_addr);
+ primary_orig_node = batadv_orig_hash_find(bat_priv,
+ primary_addr);
if (!primary_orig_node)
goto return_router;
@@ -839,7 +842,7 @@ static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
}
/* get routing information */
- orig_node = orig_hash_find(bat_priv, unicast_packet->dest);
+ orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->dest);
if (!orig_node)
goto out;
@@ -922,7 +925,8 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
tt_poss_change = bat_priv->tt_poss_change;
curr_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
} else {
- orig_node = orig_hash_find(bat_priv, unicast_packet->dest);
+ orig_node = batadv_orig_hash_find(bat_priv,
+ unicast_packet->dest);
if (!orig_node)
return 0;
@@ -1078,7 +1082,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (bcast_packet->header.ttl < 2)
goto out;
- orig_node = orig_hash_find(bat_priv, bcast_packet->orig);
+ orig_node = batadv_orig_hash_find(bat_priv, bcast_packet->orig);
if (!orig_node)
goto out;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 72a8548..1dfa231 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -61,7 +61,7 @@ static struct tt_common_entry *tt_hash_find(struct hashtable_t *hash,
if (!hash)
return NULL;
- index = choose_orig(data, hash->size);
+ index = batadv_choose_orig(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
@@ -235,7 +235,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
tt_local_entry->common.flags |= TT_CLIENT_NEW;
hash_added = batadv_hash_add(bat_priv->tt_local_hash, compare_tt,
- choose_orig, &tt_local_entry->common,
+ batadv_choose_orig,
+ &tt_local_entry->common,
&tt_local_entry->common.hash_entry);
if (unlikely(hash_added != 0)) {
@@ -639,7 +640,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
spin_lock_init(&tt_global_entry->list_lock);
hash_added = batadv_hash_add(bat_priv->tt_global_hash,
- compare_tt, choose_orig,
+ compare_tt, batadv_choose_orig,
common, &common->hash_entry);
if (unlikely(hash_added != 0)) {
@@ -818,8 +819,8 @@ static void tt_global_del_struct(struct bat_priv *bat_priv,
"Deleting global tt entry %pM: %s\n",
tt_global_entry->common.addr, message);
- batadv_hash_remove(bat_priv->tt_global_hash, compare_tt, choose_orig,
- tt_global_entry->common.addr);
+ batadv_hash_remove(bat_priv->tt_global_hash, compare_tt,
+ batadv_choose_orig, tt_global_entry->common.addr);
tt_global_entry_free_ref(tt_global_entry);
}
@@ -1454,11 +1455,11 @@ static bool send_other_tt_response(struct bat_priv *bat_priv,
(tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
/* Let's get the orig node of the REAL destination */
- req_dst_orig_node = orig_hash_find(bat_priv, tt_request->dst);
+ req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst);
if (!req_dst_orig_node)
goto out;
- res_dst_orig_node = orig_hash_find(bat_priv, tt_request->src);
+ res_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->src);
if (!res_dst_orig_node)
goto out;
@@ -1586,7 +1587,7 @@ static bool send_my_tt_response(struct bat_priv *bat_priv,
my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
req_ttvn = tt_request->ttvn;
- orig_node = orig_hash_find(bat_priv, tt_request->src);
+ orig_node = batadv_orig_hash_find(bat_priv, tt_request->src);
if (!orig_node)
goto out;
@@ -1731,7 +1732,7 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
{
struct orig_node *orig_node = NULL;
- orig_node = orig_hash_find(bat_priv, tt_response->src);
+ orig_node = batadv_orig_hash_find(bat_priv, tt_response->src);
if (!orig_node)
goto out;
@@ -1804,7 +1805,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src))
goto out;
- orig_node = orig_hash_find(bat_priv, tt_response->src);
+ orig_node = batadv_orig_hash_find(bat_priv, tt_response->src);
if (!orig_node)
goto out;
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index fff34e0..d021055 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -181,7 +181,7 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
*new_skb = NULL;
- orig_node = orig_hash_find(bat_priv, unicast_packet->orig);
+ orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->orig);
if (!orig_node)
goto out;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index e0a9057..bf72c52 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -803,7 +803,7 @@ static void unicast_vis_packet(struct bat_priv *bat_priv,
packet = (struct vis_packet *)info->skb_packet->data;
- orig_node = orig_hash_find(bat_priv, packet->target_orig);
+ orig_node = batadv_orig_hash_find(bat_priv, packet->target_orig);
if (!orig_node)
goto out;
--
1.7.9.4
^ permalink raw reply related
* [PATCH 06/20] batman-adv: Prefix unicast static inline functions with batadv_
From: Antonio Quartulli @ 2012-06-25 6:54 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1340607284-29950-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/routing.c | 3 ++-
net/batman-adv/unicast.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 0888f1e..3eb4a2e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -869,7 +869,8 @@ static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
}
if (unicast_packet->header.packet_type == BAT_UNICAST_FRAG &&
- frag_can_reassemble(skb, neigh_node->if_incoming->net_dev->mtu)) {
+ batadv_frag_can_reassemble(skb,
+ neigh_node->if_incoming->net_dev->mtu)) {
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h
index 87f8f89..9257b83 100644
--- a/net/batman-adv/unicast.h
+++ b/net/batman-adv/unicast.h
@@ -33,7 +33,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface,
const uint8_t dstaddr[]);
-static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu)
+static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
{
const struct unicast_frag_packet *unicast_packet;
int uneven_correction = 0;
--
1.7.9.4
^ 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