* [PATCH]
@ 2003-11-13 0:39 Stephen Hemminger
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2003-11-13 0:39 UTC (permalink / raw)
To: intro, jgarzik; +Cc: netdev
This is the update to Al viro's changes to probing to have all
network devices use dynamic allocation. The patches are against
net-drivers-2.5-exp.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next v3 0/3] bonding: modify the current and add new hash functions
@ 2013-09-26 14:09 Nikolay Aleksandrov
2013-09-26 14:09 ` [PATCH net-next v3 1/3] flow_dissector: factor out the ports extraction in skb_flow_get_ports Nikolay Aleksandrov
0 siblings, 1 reply; 7+ messages in thread
From: Nikolay Aleksandrov @ 2013-09-26 14:09 UTC (permalink / raw)
To: netdev; +Cc: davem, andy, fubar, eric.dumazet, vfalico
Hi all,
This is a complete remake of my old patch that modified the bonding hash
functions to use skb_flow_dissect which was suggested by Eric Dumazet.
This time around I've left the old modes although using a new hash function
again suggested by Eric, which is the same for all modes. The only
difference is the way the headers are obtained. The old modes obtain them
as before in order to address concerns about speed, but the 2 new ones use
skb_flow_dissect. The unification of the hash function allows to remove a
pointer from struct bonding and also a few extra functions that dealt with
it. Two new functions are added which take care of the hashing based on
bond->params.xmit_policy only:
bond_xmit_hash() - global function, used by XOR and 3ad modes
bond_flow_dissect() - used by bond_xmit_hash() to obtain the necessary
headers and combine them according to bond->params.xmit_policy.
Also factor out the ports extraction from skb_flow_dissect and add a new
function - skb_flow_get_ports() which can be re-used.
v2: add the flow_dissector patch and use skb_flow_get_ports in patch 02
v3: fix a bug in the flow_dissector patch that caused a different thoff
by modifying the thoff argument in skb_flow_get_ports directly, most
of the users already do it anyway.
Also add the necessary export symbol for skb_flow_get_ports.
Best regards,
Nikolay Aleksandrov
Nikolay Aleksandrov (3):
flow_dissector: factor out the ports extraction in skb_flow_get_ports
bonding: modify the old and add new xmit hash policies
bonding: document the new xmit policy modes and update the changed
ones
Documentation/networking/bonding.txt | 66 ++++++------
drivers/net/bonding/bond_3ad.c | 2 +-
drivers/net/bonding/bond_main.c | 197 ++++++++++++-----------------------
drivers/net/bonding/bond_sysfs.c | 2 -
drivers/net/bonding/bonding.h | 3 +-
include/net/flow_keys.h | 1 +
include/uapi/linux/if_bonding.h | 2 +
net/core/flow_dissector.c | 41 ++++++--
8 files changed, 139 insertions(+), 175 deletions(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next v3 1/3] flow_dissector: factor out the ports extraction in skb_flow_get_ports
2013-09-26 14:09 [PATCH net-next v3 0/3] bonding: modify the current and add new hash functions Nikolay Aleksandrov
@ 2013-09-26 14:09 ` Nikolay Aleksandrov
2013-09-26 15:27 ` [PATCH] Eric Dumazet
0 siblings, 1 reply; 7+ messages in thread
From: Nikolay Aleksandrov @ 2013-09-26 14:09 UTC (permalink / raw)
To: netdev; +Cc: davem, andy, fubar, eric.dumazet, vfalico
Factor out the code that extracts the ports from skb_flow_dissect and
add a new function skb_flow_get_ports which can be re-used.
Suggested-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: new patch
v3: fix a bug in skb_flow_dissect where thoff didn't have poff added by
modifying thoff directly in skb_flow_get_ports as it's done anyway.
Also add the necessary export symbol for skb_flow_get_ports.
This seems like a good idea because there're other users that can re-use
it later as well.
include/net/flow_keys.h | 1 +
net/core/flow_dissector.c | 41 ++++++++++++++++++++++++++++++-----------
2 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index ac2439d..4db84ae 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -14,4 +14,5 @@ struct flow_keys {
};
bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
+__be32 skb_flow_get_ports(const struct sk_buff *skb, int *thoff, u8 ip_proto);
#endif
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 1929af8..7785398 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -25,9 +25,37 @@ static void iph_to_flow_copy_addrs(struct flow_keys *flow, const struct iphdr *i
memcpy(&flow->src, &iph->saddr, sizeof(flow->src) + sizeof(flow->dst));
}
+/**
+ * skb_flow_get_ports - extract the upper layer ports and return them
+ * @skb: buffer to extract the ports from
+ * @thoff: pointer to transport header offset
+ * @ip_proto: protocol for which to get port offset
+ *
+ * The function will try to retrieve the ports at offset thoff + poff where poff
+ * is the protocol port offset returned from proto_ports_offset, and if poff is
+ * more than or equal to 0 it'll add it to the value at the thoff address
+ */
+__be32 skb_flow_get_ports(const struct sk_buff *skb, int *thoff, u8 ip_proto)
+{
+ int poff = proto_ports_offset(ip_proto);
+
+ if (poff >= 0) {
+ __be32 *ports, _ports;
+
+ *thoff += poff;
+ ports = skb_header_pointer(skb, *thoff, sizeof(_ports),
+ &_ports);
+ if (ports)
+ return *ports;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(skb_flow_get_ports);
+
bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
{
- int poff, nhoff = skb_network_offset(skb);
+ int nhoff = skb_network_offset(skb);
u8 ip_proto;
__be16 proto = skb->protocol;
@@ -150,16 +178,7 @@ ipv6:
}
flow->ip_proto = ip_proto;
- poff = proto_ports_offset(ip_proto);
- if (poff >= 0) {
- __be32 *ports, _ports;
-
- nhoff += poff;
- ports = skb_header_pointer(skb, nhoff, sizeof(_ports), &_ports);
- if (ports)
- flow->ports = *ports;
- }
-
+ flow->ports = skb_flow_get_ports(skb, &nhoff, ip_proto);
flow->thoff = (u16) nhoff;
return true;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH]
2013-09-26 14:09 ` [PATCH net-next v3 1/3] flow_dissector: factor out the ports extraction in skb_flow_get_ports Nikolay Aleksandrov
@ 2013-09-26 15:27 ` Eric Dumazet
2013-09-26 15:40 ` [PATCH] Nikolay Aleksandrov
0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2013-09-26 15:27 UTC (permalink / raw)
To: Nikolay Aleksandrov, Daniel Borkmann; +Cc: netdev, davem, andy, fubar, vfalico
On Thu, 2013-09-26 at 16:09 +0200, Nikolay Aleksandrov wrote:
> Factor out the code that extracts the ports from skb_flow_dissect and
> add a new function skb_flow_get_ports which can be re-used.
>
> Suggested-by: Veaceslav Falico <vfalico@redhat.com>
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
> ---
> v2: new patch
> v3: fix a bug in skb_flow_dissect where thoff didn't have poff added by
> modifying thoff directly in skb_flow_get_ports as it's done anyway.
> Also add the necessary export symbol for skb_flow_get_ports.
> This seems like a good idea because there're other users that can re-use
> it later as well.
Wait a minute.... existing code seems buggy.
Daniel, any objection if I submit this fix ?
(commit 8ed781668dd49b608f)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 1929af8..8d7d0dd 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -154,8 +154,8 @@ ipv6:
if (poff >= 0) {
__be32 *ports, _ports;
- nhoff += poff;
- ports = skb_header_pointer(skb, nhoff, sizeof(_ports), &_ports);
+ ports = skb_header_pointer(skb, nhoff + poff,
+ sizeof(_ports), &_ports);
if (ports)
flow->ports = *ports;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH]
2013-09-26 15:27 ` [PATCH] Eric Dumazet
@ 2013-09-26 15:40 ` Nikolay Aleksandrov
2013-09-26 15:44 ` [PATCH] Nikolay Aleksandrov
2013-09-26 15:53 ` [PATCH] Eric Dumazet
0 siblings, 2 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2013-09-26 15:40 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Daniel Borkmann, netdev, davem, andy, fubar, vfalico
On 09/26/2013 05:27 PM, Eric Dumazet wrote:
> On Thu, 2013-09-26 at 16:09 +0200, Nikolay Aleksandrov wrote:
>> Factor out the code that extracts the ports from skb_flow_dissect and
>> add a new function skb_flow_get_ports which can be re-used.
>>
>> Suggested-by: Veaceslav Falico <vfalico@redhat.com>
>> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
>> ---
>> v2: new patch
>> v3: fix a bug in skb_flow_dissect where thoff didn't have poff added by
>> modifying thoff directly in skb_flow_get_ports as it's done anyway.
>> Also add the necessary export symbol for skb_flow_get_ports.
>> This seems like a good idea because there're other users that can re-use
>> it later as well.
>
> Wait a minute.... existing code seems buggy.
>
> Daniel, any objection if I submit this fix ?
>
> (commit 8ed781668dd49b608f)
>
1 question, I might be missing something but proto_ports_offset() gets the SPI
with that 4 byte offset as is written in the comments, in every other case
proto_ports_offset() is 0, so why would we want the SPI in the ->ports field ?
And even then isn't it supposed to be 16 bits (2 bytes) and not 4, since we need
to pass over "next header" (8 bits) and length (8 bits) ?
Thanks,
Nik
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]
2013-09-26 15:40 ` [PATCH] Nikolay Aleksandrov
@ 2013-09-26 15:44 ` Nikolay Aleksandrov
2013-09-26 15:53 ` [PATCH] Eric Dumazet
1 sibling, 0 replies; 7+ messages in thread
From: Nikolay Aleksandrov @ 2013-09-26 15:44 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Daniel Borkmann, netdev, davem, andy, fubar, vfalico
On 09/26/2013 05:40 PM, Nikolay Aleksandrov wrote:
> On 09/26/2013 05:27 PM, Eric Dumazet wrote:
>> On Thu, 2013-09-26 at 16:09 +0200, Nikolay Aleksandrov wrote:
>>> Factor out the code that extracts the ports from skb_flow_dissect and
>>> add a new function skb_flow_get_ports which can be re-used.
>>>
>>> Suggested-by: Veaceslav Falico <vfalico@redhat.com>
>>> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
>>> ---
>>> v2: new patch
>>> v3: fix a bug in skb_flow_dissect where thoff didn't have poff added by
>>> modifying thoff directly in skb_flow_get_ports as it's done anyway.
>>> Also add the necessary export symbol for skb_flow_get_ports.
>>> This seems like a good idea because there're other users that can re-use
>>> it later as well.
>>
>> Wait a minute.... existing code seems buggy.
>>
>> Daniel, any objection if I submit this fix ?
>>
>> (commit 8ed781668dd49b608f)
>>
> 1 question, I might be missing something but proto_ports_offset() gets the SPI
> with that 4 byte offset as is written in the comments, in every other case
> proto_ports_offset() is 0, so why would we want the SPI in the ->ports field ?
> And even then isn't it supposed to be 16 bits (2 bytes) and not 4, since we need
> to pass over "next header" (8 bits) and length (8 bits) ?
>
Nevermind the second part, I forgot about the 16-bit 0 region :-)
> Thanks,
> Nik
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]
2013-09-26 15:40 ` [PATCH] Nikolay Aleksandrov
2013-09-26 15:44 ` [PATCH] Nikolay Aleksandrov
@ 2013-09-26 15:53 ` Eric Dumazet
1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2013-09-26 15:53 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: Daniel Borkmann, netdev, davem, andy, fubar, vfalico
On Thu, 2013-09-26 at 17:40 +0200, Nikolay Aleksandrov wrote:
> >
> 1 question, I might be missing something but proto_ports_offset() gets the SPI
> with that 4 byte offset as is written in the comments, in every other case
> proto_ports_offset() is 0, so why would we want the SPI in the ->ports field ?
> And even then isn't it supposed to be 16 bits (2 bytes) and not 4, since we need
> to pass over "next header" (8 bits) and length (8 bits) ?
struct ip_auth_hdr {
__u8 nexthdr;
__u8 hdrlen; /* This one is measured in 32 bit units! */
__be16 reserved;
__be32 spi;
__be32 seq_no; /* Sequence number */
__u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
};
offsetof(spi, struct ...) = 4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH]
@ 2003-12-27 13:50 Bart De Schuymer
0 siblings, 0 replies; 7+ messages in thread
From: Bart De Schuymer @ 2003-12-27 13:50 UTC (permalink / raw)
To: David S.Miller; +Cc: netdev, Stephen Hemminger
Hi Dave,
We should also filter vlan-tagged IP/ARP traffic even if the vlan code
isn't compiled into the kernel. The patch below removes an unnecessary
dependence on the vlan code being compiled.
cheers,
Bart
--- linux-2.6.0/include/linux/netfilter_bridge.h.earlier 2003-12-25 17:01:38.000000000 +0100
+++ linux-2.6.0/include/linux/netfilter_bridge.h 2003-12-25 17:02:56.000000000 +0100
@@ -71,12 +71,10 @@ static inline
void nf_bridge_maybe_copy_header(struct sk_buff *skb)
{
if (skb->nf_bridge) {
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
if (skb->protocol == __constant_htons(ETH_P_8021Q)) {
memcpy(skb->data - 18, skb->nf_bridge->data, 18);
skb_push(skb, 4);
} else
-#endif
memcpy(skb->data - 16, skb->nf_bridge->data, 16);
}
}
@@ -86,10 +84,9 @@ void nf_bridge_save_header(struct sk_buf
{
int header_size = 16;
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
if (skb->protocol == __constant_htons(ETH_P_8021Q))
header_size = 18;
-#endif
+
memcpy(skb->nf_bridge->data, skb->data - header_size, header_size);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH]
@ 2003-07-08 22:16 Stephen Hemminger
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2003-07-08 22:16 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Convert Digi RigtSwitch to use alloc_etherdev.
Builds (on 2.5.74) but once again, do not have real hardware to test.
diff -Nru a/drivers/net/dgrs.c b/drivers/net/dgrs.c
--- a/drivers/net/dgrs.c Mon Jul 7 14:50:36 2003
+++ b/drivers/net/dgrs.c Mon Jul 7 14:50:36 2003
@@ -1252,18 +1252,12 @@
{
DGRS_PRIV *priv;
struct net_device *dev, *aux;
-
- /* Allocate and fill new device structure. */
- int dev_size = sizeof(struct net_device) + sizeof(DGRS_PRIV);
int i, ret;
- dev = (struct net_device *) kmalloc(dev_size, GFP_KERNEL);
-
+ dev = alloc_etherdev(sizeof(DGRS_PRIV));
if (!dev)
return -ENOMEM;
- memset(dev, 0, dev_size);
- dev->priv = ((void *)dev) + sizeof(struct net_device);
priv = (DGRS_PRIV *)dev->priv;
dev->base_addr = io;
@@ -1279,7 +1273,7 @@
dev->init = dgrs_probe1;
SET_MODULE_OWNER(dev);
- ether_setup(dev);
+
if (register_netdev(dev) != 0) {
kfree(dev);
return -EIO;
@@ -1302,15 +1296,18 @@
struct net_device *devN;
DGRS_PRIV *privN;
/* Allocate new dev and priv structures */
- devN = (struct net_device *) kmalloc(dev_size, GFP_KERNEL);
- /* Make it an exact copy of dev[0]... */
+ devN = alloc_etherdev(sizeof(DGRS_PRIV));
ret = -ENOMEM;
if (!devN)
goto fail;
- memcpy(devN, dev, dev_size);
- memset(devN->name, 0, sizeof(devN->name));
- devN->priv = ((void *)devN) + sizeof(struct net_device);
+
+ /* Make it an exact copy of dev[0]... */
+ *devN = *dev;
+
+ /* copy the priv structure of dev[0] */
privN = (DGRS_PRIV *)devN->priv;
+ *privN = *priv;
+
/* ... and zero out VM areas */
privN->vmem = 0;
privN->vplxdma = 0;
@@ -1318,9 +1315,11 @@
devN->irq = 0;
/* ... and base MAC address off address of 1st port */
devN->dev_addr[5] += i;
+ /* ... choose a new name */
+ strncpy(devN->name, "eth%d", IFNAMSIZ);
devN->init = dgrs_initclone;
SET_MODULE_OWNER(devN);
- ether_setup(devN);
+
ret = -EIO;
if (register_netdev(devN)) {
kfree(devN);
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-26 15:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13 0:39 [PATCH] Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2013-09-26 14:09 [PATCH net-next v3 0/3] bonding: modify the current and add new hash functions Nikolay Aleksandrov
2013-09-26 14:09 ` [PATCH net-next v3 1/3] flow_dissector: factor out the ports extraction in skb_flow_get_ports Nikolay Aleksandrov
2013-09-26 15:27 ` [PATCH] Eric Dumazet
2013-09-26 15:40 ` [PATCH] Nikolay Aleksandrov
2013-09-26 15:44 ` [PATCH] Nikolay Aleksandrov
2013-09-26 15:53 ` [PATCH] Eric Dumazet
2003-12-27 13:50 [PATCH] Bart De Schuymer
2003-07-08 22:16 [PATCH] Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).