netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Wise <swise@opengridcomputing.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Karen Xie <kxie@chelsio.com>,
	netdev@vger.kernel.org, open-iscsi@googlegroups.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	jgarzik@pobox.com, davem@davemloft.net, michaelc@cs.wisc.edu,
	rdreier@cisco.com, daisyc@us.ibm.com, wenxiong@us.ibm.com,
	bhua@us.ibm.com, divy@chelsio.com, dm@chelsio.com,
	leedom@chelsio.com
Subject: Re: [PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address
Date: Fri, 22 Aug 2008 14:32:43 -0500	[thread overview]
Message-ID: <48AF145B.903@opengridcomputing.com> (raw)
In-Reply-To: <20080822121250.55949d3d.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Fri, 22 Aug 2008 11:39:08 -0700
> Karen Xie <kxie@chelsio.com> wrote:
>
>   
>> [PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address
>>
>> From: Karen Xie <kxie@chelsio.com>
>>
>> stg can be tricky ...
>> [adding @adapter in cxgb3_arp_process doxygen header]
>> The accelerated iSCSI traffic uses a private IP address unknown to the OS.
>> The driver has to reply to ARP requests dedicated to the private IP address.
>>
>> Signed-off-by: Divy Le Ray <divy@chelsio.com>
>> ---
>>
>>  drivers/net/cxgb3/sge.c |   71 ++++++++++++++++++++++++++++++++++++++++++++---
>>  1 files changed, 66 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
>> index 1b0861d..d2a9285 100644
>> --- a/drivers/net/cxgb3/sge.c
>> +++ b/drivers/net/cxgb3/sge.c
>> @@ -36,6 +36,7 @@
>>  #include <linux/ip.h>
>>  #include <linux/tcp.h>
>>  #include <linux/dma-mapping.h>
>> +#include <net/arp.h>
>>  #include "common.h"
>>  #include "regs.h"
>>  #include "sge_defs.h"
>> @@ -1859,6 +1860,54 @@ static void restart_tx(struct sge_qset *qs)
>>  }
>>  
>>  /**
>> + *	cxgb3_arp_process - process an ARP request probing a private IP address
>> + *	@adapter: the adapter
>> + *	@skb: the skbuff containing the ARP request
>> + *
>> + *	Check if the ARP request is probing the private IP address
>> + *	dedicated to iSCSI, generate an ARP reply if so.
>> + */
>> +static void cxgb3_arp_process(struct adapter *adapter, struct sk_buff *skb)
>> +{
>> +	struct net_device *dev = skb->dev;
>> +	struct port_info *pi;
>> +	struct arphdr *arp;
>> +	unsigned char *arp_ptr;
>> +	unsigned char *sha;
>> +	u32 sip, tip;
>> +
>> +	if (!dev)
>> +		return;
>>     
>
> Can this happen?
>
>   
>> +	skb_reset_network_header(skb);
>> +	arp = arp_hdr(skb);
>> +
>> +	if (arp->ar_op != htons(ARPOP_REQUEST))
>> +		return;
>> +
>> +	arp_ptr = (unsigned char *)(arp + 1);
>> +	sha = arp_ptr;
>> +	arp_ptr += dev->addr_len;
>> +	memcpy(&sip, arp_ptr, 4);
>> +	arp_ptr += 4;
>> +	arp_ptr += dev->addr_len;
>> +	memcpy(&tip, arp_ptr, 4);
>>     
>
> Should arp_hdr_len() be used here?
>
>   
>> +	pi = netdev_priv(dev);
>> +	if (ntohl(tip) != pi->iscsi_ipaddr)
>> +		return;
>> +
>> +	arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
>> +		 dev->dev_addr, sha);
>> +
>> +}
>> +
>> +static inline int is_arp(struct sk_buff *skb)
>> +{
>> +	return skb->protocol == htons(ETH_P_ARP);
>>     
>
> Other net code uses __constant_htons() for this.
>
> (Dunno why - if it makes a difference, htons() is broken?)
>
>
>   
Doesn't this avoid complaints from sparse endian checking?



  reply	other threads:[~2008-08-22 19:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22 18:39 [PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address Karen Xie
2008-08-22 19:12 ` Andrew Morton
2008-08-22 19:32   ` Steve Wise [this message]
2008-08-25 13:45   ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2008-08-28  4:21 Karen Xie
2008-09-13 19:31 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48AF145B.903@opengridcomputing.com \
    --to=swise@opengridcomputing.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhua@us.ibm.com \
    --cc=daisyc@us.ibm.com \
    --cc=davem@davemloft.net \
    --cc=divy@chelsio.com \
    --cc=dm@chelsio.com \
    --cc=jgarzik@pobox.com \
    --cc=kxie@chelsio.com \
    --cc=leedom@chelsio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=netdev@vger.kernel.org \
    --cc=open-iscsi@googlegroups.com \
    --cc=rdreier@cisco.com \
    --cc=wenxiong@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).