* [PATCH] qeth: Move away from using neighbour entries in qeth_l3_fill_header()
@ 2012-02-01 20:49 David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-02-01 20:49 UTC (permalink / raw)
To: elelueck; +Cc: ursula.braun, netdev
We've moving to a model where dst_entry objects to not have
a reference to the associated neighbour entry, instead such
neighbours must be looked up on-demand.
Here in qeth_l3_fill_header() it's actually much simpler to
use the information in the route itself. The code is
already conditionalized upon protocol type.
Signed-off-by: David S. Miller <davem@davemloft.net>
--
If one of you could test this against net-next, I'd appreciate
it. I plan to make similar changes to the other dst_get_neighbour*()
call in this driver.
Thanks!
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 9648e4e..6d95c38 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2832,7 +2832,6 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_card *card,
static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
struct sk_buff *skb, int ipv, int cast_type)
{
- struct neighbour *n = NULL;
struct dst_entry *dst;
memset(hdr, 0, sizeof(struct qeth_hdr));
@@ -2855,33 +2854,29 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
rcu_read_lock();
dst = skb_dst(skb);
- if (dst)
- n = dst_get_neighbour_noref(dst);
if (ipv == 4) {
+ struct rtable *rt = (struct rtable *) dst;
+ __be32 *pkey = &ip_hdr(skb)->daddr;
+
+ if (rt->rt_gateway)
+ pkey = &rt->rt_gateway;
+
/* IPv4 */
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
memset(hdr->hdr.l3.dest_addr, 0, 12);
- if (n) {
- *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
- *((u32 *) n->primary_key);
- } else {
- /* fill in destination address used in ip header */
- *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
- ip_hdr(skb)->daddr;
- }
+ *((__be32 *) (&hdr->hdr.l3.dest_addr[12])) = *pkey;
} else if (ipv == 6) {
+ struct rt6_info *rt = (struct rt6_info *) dst;
+ struct in6_addr *pkey = &ipv6_hdr(skb)->daddr;
+
+ if (!ipv6_addr_any(&rt->rt6i_gateway))
+ pkey = &rt->rt6i_gateway;
+
/* IPv6 */
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
if (card->info.type == QETH_CARD_TYPE_IQD)
hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
- if (n) {
- memcpy(hdr->hdr.l3.dest_addr,
- n->primary_key, 16);
- } else {
- /* fill in destination address used in ip header */
- memcpy(hdr->hdr.l3.dest_addr,
- &ipv6_hdr(skb)->daddr, 16);
- }
+ memcpy(hdr->hdr.l3.dest_addr, pkey, 16);
} else {
/* passthrough */
if ((skb->dev->type == ARPHRD_IEEE802_TR) &&
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] qeth: Move away from using neighbour entries in qeth_l3_fill_header()
[not found] <OF3D0DFDEF.D4DC17E5-ONC1257998.00496C84-C1257998.0049A282@de.ibm.com>
@ 2012-02-02 13:44 ` Ursula Braun
2012-02-02 19:36 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Ursula Braun @ 2012-02-02 13:44 UTC (permalink / raw)
To: davem; +Cc: Ursula Braun1, netdev, elelueck
Dave,
I have tested your qeth patch on top of net-next with ipv4 and ipv6
traffic successfully. I just had to add includes for net/route.h and
net/ip6_fib.h.
Regards, Ursula Braun, IBM Germany, Linux on System z development
> From:
> David Miller <davem@davemloft.net>
> To:
> Einar EL Lueck/Germany/IBM@IBMDE
> Cc:
> Ursula Braun1/Germany/IBM@IBMDE, netdev@vger.kernel.org
> Date:
> 01/02/2012 21:49
> Subject:
> [PATCH] qeth: Move away from using neighbour entries in
> qeth_l3_fill_header()
>
>
>
>
> We've moving to a model where dst_entry objects to not have
> a reference to the associated neighbour entry, instead such
> neighbours must be looked up on-demand.
>
> Here in qeth_l3_fill_header() it's actually much simpler to
> use the information in the route itself. The code is
> already conditionalized upon protocol type.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> --
> If one of you could test this against net-next, I'd appreciate
> it. I plan to make similar changes to the other dst_get_neighbour*()
> call in this driver.
>
> Thanks!
>
> diff --git a/drivers/s390/net/qeth_l3_main.c
> b/drivers/s390/net/qeth_l3_main.c
> index 9648e4e..6d95c38 100644
> --- a/drivers/s390/net/qeth_l3_main.c
> +++ b/drivers/s390/net/qeth_l3_main.c
> @@ -2832,7 +2832,6 @@ static void qeth_l3_fill_af_iucv_hdr(struct
> qeth_card *card,
> static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr
> *hdr,
> struct sk_buff *skb, int ipv, int
> cast_type)
> {
> - struct neighbour *n = NULL;
> struct dst_entry *dst;
>
> memset(hdr, 0, sizeof(struct qeth_hdr));
> @@ -2855,33 +2854,29 @@ static void qeth_l3_fill_header(struct qeth_card
> *card, struct qeth_hdr *hdr,
>
> rcu_read_lock();
> dst = skb_dst(skb);
> - if (dst)
> - n = dst_get_neighbour_noref(dst);
> if (ipv == 4) {
> + struct rtable *rt = (struct rtable *)
> dst;
> + __be32 *pkey = &ip_hdr(skb)->daddr;
> +
> + if (rt->rt_gateway)
> + pkey = &rt->rt_gateway;
> +
> /* IPv4 */
> hdr->hdr.l3.flags =
> qeth_l3_get_qeth_hdr_flags4(cast_type);
> memset(hdr->hdr.l3.dest_addr, 0, 12);
> - if (n) {
> - *((u32 *)
> (&hdr->hdr.l3.dest_addr[12])) =
> - *((u32 *)
> n->primary_key);
> - } else {
> - /* fill in destination
> address used in ip header */
> - *((u32 *)
> (&hdr->hdr.l3.dest_addr[12])) =
> - ip_hdr(skb)->daddr;
> - }
> + *((__be32 *)
> (&hdr->hdr.l3.dest_addr[12])) = *pkey;
> } else if (ipv == 6) {
> + struct rt6_info *rt = (struct rt6_info *)
> dst;
> + struct in6_addr *pkey =
> &ipv6_hdr(skb)->daddr;
> +
> + if (!ipv6_addr_any(&rt->rt6i_gateway))
> + pkey = &rt->rt6i_gateway;
> +
> /* IPv6 */
> hdr->hdr.l3.flags =
> qeth_l3_get_qeth_hdr_flags6(cast_type);
> if (card->info.type ==
> QETH_CARD_TYPE_IQD)
> hdr->hdr.l3.flags &=
> ~QETH_HDR_PASSTHRU;
> - if (n) {
> - memcpy(hdr->hdr.l3.dest_addr,
> - n->primary_key,
> 16);
> - } else {
> - /* fill in destination
> address used in ip header */
> - memcpy(hdr->hdr.l3.dest_addr,
> - &ipv6_hdr(skb)->daddr, 16);
> - }
> + memcpy(hdr->hdr.l3.dest_addr, pkey, 16);
> } else {
> /* passthrough */
> if ((skb->dev->type == ARPHRD_IEEE802_TR)
> &&
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] qeth: Move away from using neighbour entries in qeth_l3_fill_header()
2012-02-02 13:44 ` [PATCH] qeth: Move away from using neighbour entries in qeth_l3_fill_header() Ursula Braun
@ 2012-02-02 19:36 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-02-02 19:36 UTC (permalink / raw)
To: ubraun; +Cc: ursula.braun, netdev, elelueck
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date: Thu, 02 Feb 2012 14:44:51 +0100
> I have tested your qeth patch on top of net-next with ipv4 and ipv6
> traffic successfully. I just had to add includes for net/route.h and
> net/ip6_fib.h.
Thanks a lot, here is the final version I checked in:
--------------------
qeth: Move away from using neighbour entries in qeth_l3_fill_header()
We've moving to a model where dst_entry objects to not have
a reference to the associated neighbour entry, instead such
neighbours must be looked up on-demand.
Here in qeth_l3_fill_header() it's actually much simpler to
use the information in the route itself. The code is
already conditionalized upon protocol type.
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_l3_main.c | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 9648e4e..25cd379 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -28,6 +28,8 @@
#include <net/ip.h>
#include <net/arp.h>
+#include <net/route.h>
+#include <net/ip6_fib.h>
#include <net/ip6_checksum.h>
#include <net/iucv/af_iucv.h>
@@ -2832,7 +2834,6 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_card *card,
static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
struct sk_buff *skb, int ipv, int cast_type)
{
- struct neighbour *n = NULL;
struct dst_entry *dst;
memset(hdr, 0, sizeof(struct qeth_hdr));
@@ -2855,33 +2856,29 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
rcu_read_lock();
dst = skb_dst(skb);
- if (dst)
- n = dst_get_neighbour_noref(dst);
if (ipv == 4) {
+ struct rtable *rt = (struct rtable *) dst;
+ __be32 *pkey = &ip_hdr(skb)->daddr;
+
+ if (rt->rt_gateway)
+ pkey = &rt->rt_gateway;
+
/* IPv4 */
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
memset(hdr->hdr.l3.dest_addr, 0, 12);
- if (n) {
- *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
- *((u32 *) n->primary_key);
- } else {
- /* fill in destination address used in ip header */
- *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
- ip_hdr(skb)->daddr;
- }
+ *((__be32 *) (&hdr->hdr.l3.dest_addr[12])) = *pkey;
} else if (ipv == 6) {
+ struct rt6_info *rt = (struct rt6_info *) dst;
+ struct in6_addr *pkey = &ipv6_hdr(skb)->daddr;
+
+ if (!ipv6_addr_any(&rt->rt6i_gateway))
+ pkey = &rt->rt6i_gateway;
+
/* IPv6 */
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
if (card->info.type == QETH_CARD_TYPE_IQD)
hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
- if (n) {
- memcpy(hdr->hdr.l3.dest_addr,
- n->primary_key, 16);
- } else {
- /* fill in destination address used in ip header */
- memcpy(hdr->hdr.l3.dest_addr,
- &ipv6_hdr(skb)->daddr, 16);
- }
+ memcpy(hdr->hdr.l3.dest_addr, pkey, 16);
} else {
/* passthrough */
if ((skb->dev->type == ARPHRD_IEEE802_TR) &&
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-02 19:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <OF3D0DFDEF.D4DC17E5-ONC1257998.00496C84-C1257998.0049A282@de.ibm.com>
2012-02-02 13:44 ` [PATCH] qeth: Move away from using neighbour entries in qeth_l3_fill_header() Ursula Braun
2012-02-02 19:36 ` David Miller
2012-02-01 20:49 David Miller
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).