All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Feldman <sfeldma@pobox.com>
To: Ed L Cashin <ecashin@coraid.com>
Cc: linux-kernel@vger.kernel.org, Greg KH <greg@kroah.com>
Subject: Re: [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11
Date: Fri, 17 Dec 2004 23:48:05 -0800	[thread overview]
Message-ID: <1103356085.3369.140.camel@sfeldma-mobl.dsl-verizon.net> (raw)
In-Reply-To: <87k6rhc4uk.fsf@coraid.com>

On Fri, 2004-12-17 at 07:38, Ed L Cashin wrote:

> +       ETH_P_AOE = 0x88a2,

include/linux/if_ether.h already defines this as ETH_P_EDP2=0x88A2; use
that.

> +static int
> +aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h)
> +{
> +       u16 type = __constant_cpu_to_be16(ETH_P_AOE);
                                                                                How about __constant_htons()?
                                                                                > +aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
> +{
> +       struct aoe_hdr *h;
> +       struct aoe_cfghdr *ch;
> +       struct sk_buff *skb, *sl;
> +       struct net_device *ifp;
> +       u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE);

Ditto

> +enum {
> +       IFLISTSZ = 1024,
> +};
> +
> +static char aoe_iflist[IFLISTSZ];
> +
> +int
> +is_aoe_netif(struct net_device *ifp)
> +{
> +       register char *p, *q;
> +       register int len;
> +
> +       if (aoe_iflist[0] == '\0')
> +               return 1;
> +
> +       for (p = aoe_iflist; *p; p = q + strspn(q, WHITESPACE)) {
> +               q = p + strcspn(p, WHITESPACE);
> +               if (q != p)
> +                       len = q - p;
> +               else
> +                       len = strlen(p); /* last token in aoe_iflist
*/
> +
> +               if (strlen(ifp->name) == len && !strncmp(ifp->name, p,
len))
> +                       return 1;
> +               if (q == p)
> +                       break;
> +       }
> +
> +       return 0;
> +}

This is getting called for every skb received.  Do you really want to
walk a string array looking for "eth0" or "eth1" for every receive
packet?  Maybe making the locals "register" helps speed things up.  :-)

Seriously, can you achieve the same by registering the packet type
handler for each dev and let netif_receive_skb() do the check for
skb->dev == packet_type->dev?

> +skb_check(struct sk_buff *skb)
> +{
> +       if (skb_is_nonlinear(skb))
> +       if ((skb = skb_share_check(skb, GFP_ATOMIC)))
> +       if (skb_linearize(skb, GFP_ATOMIC) < 0) {
> +               dev_kfree_skb(skb);
> +               return NULL;
> +       }

indentation of if's

> + * (1) i have no idea if this is redundant, but i can't figure why
> + * the ifp is passed in if it is.

This isn't necessary - see deliver_skb()

> +       skb->len += ETH_HLEN;   /* (2) */

You want to do a skb_push(skb, ETH_HLEN) here instead to keep skb->len
and skb->data corresponding (basically to undo the skb->pull() in
eth_type_trans()).  skb->mac.raw will still be correct.

> +       n = __be32_to_cpu(*((u32 *) h->tag));

Use ntohl() variant since this is network header field.

> +       if (h->verfl & AOEFL_ERR) {
> +               n = h->err;
> +               if (n > NECODES)
> +                       n = 0;
> +               printk(KERN_CRIT "aoe: aoenet_rcv: error packet from
%d.%d; "
> +                       "ecode=%d '%s'\n",
> +                      __be16_to_cpu(*((u16 *) h->major)), h->minor,
> +                       h->err, aoe_errlist[n]);
> +               goto exit;
> +       }

Is there a better way to handle errors than flooding the log?

> +       dev_kfree_skb(skb);

kfree_skb() should be enough.

-scott


  parent reply	other threads:[~2004-12-18  7:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-17 15:38 [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11 Ed L Cashin
2004-12-17 22:53 ` Greg KH
2004-12-18  7:48 ` Scott Feldman [this message]
2004-12-18  7:55   ` Jeff Garzik
2004-12-20 16:21   ` [PATCH] ETH_P_AOE (was Re: [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11) Ed L Cashin
2004-12-21 18:54     ` Greg KH
2004-12-21 15:21   ` [PATCH] ATA over Ethernet driver for 2.6.10-rc3-bk11 Ed L Cashin
2004-12-22 13:19   ` Ed L Cashin
2004-12-22 13:55     ` Alan Cox
     [not found] <87k6rhc4uk.fsf@coraid.com.suse.lists.linux.kernel>
2004-12-18  9:11 ` Andi Kleen

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=1103356085.3369.140.camel@sfeldma-mobl.dsl-verizon.net \
    --to=sfeldma@pobox.com \
    --cc=ecashin@coraid.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.