netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: "Kevin Pedretti" <ktpedre@sandia.gov>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] seastar - SeaStar Ethernet driver
Date: Tue, 2 Feb 2010 15:38:04 -0800	[thread overview]
Message-ID: <20100202153804.6aa49835@nehalam> (raw)
In-Reply-To: <20100202205845.GE5246@hawkeye.sandia.gov>

On Tue, 2 Feb 2010 13:58:45 -0700
"Kevin Pedretti" <ktpedre@sandia.gov> wrote:

> +
> +static const struct net_device_ops ss_netdev_ops = {
> +	.ndo_open		= ss_open,
> +	.ndo_start_xmit		= ss_tx,
> +	.ndo_set_mac_address	= eth_mac_addr,
> +};

You should have a validate_address as well.
> +
> +
> +static const struct header_ops ss_header_ops = {
> +	.create			= ss_header_create,
> +};
> +
> +
> +static void ss_ht_irq_update(struct pci_dev *dev, int irq,
> +			     struct ht_irq_msg *msg)
> +{
> +	seastar_setup_htb_bi(msg->address_lo);
> +}
> +
> +
> +static int __devinit ss_probe(struct pci_dev *pdev,
> +			      const struct pci_device_id *id)
> +{
> +	struct net_device *netdev;
> +	struct ss_priv *ssp;
> +	int i, irq, err = 0;
> +
> +	err = pci_enable_device(pdev);
> +	if (err != 0) {
> +		dev_err(&pdev->dev, "Could not enable PCI device.\n");
> +		return -ENODEV;
> +	}
> +
> +	netdev = alloc_etherdev(sizeof(*ssp));
> +	if (netdev == NULL) {
> +		dev_err(&pdev->dev, "Could not allocate ethernet device.\n");
> +		return -ENOMEM;
> +	}

You may want to use alloc_netdev() since this starts to look
like a non-ethernet device.
> +
> +	SET_NETDEV_DEV(netdev, &pdev->dev);
> +
> +	strcpy(netdev->name, "ss");
> +	netdev->netdev_ops	= &ss_netdev_ops;
> +	netdev->header_ops	= &ss_header_ops;
> +	netdev->mtu		= 16000;
> +	netdev->flags		= IFF_NOARP;
> +
> +	/* Setup private state */
> +	ssp = netdev_priv(netdev);
> +	memset(ssp, 0, sizeof(*ssp));

memset is unnecessary, since alloc_netdev/alloc_etherdev zero that area
already.
-- 

  parent reply	other threads:[~2010-02-02 23:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 20:58 [PATCH] seastar - SeaStar Ethernet driver Kevin Pedretti
2010-02-02 21:42 ` David Miller
2010-02-03  1:24   ` Kevin Pedretti
2010-02-03  1:40     ` David Miller
2010-02-03  1:41       ` David Miller
2010-02-04 23:01       ` Kevin Pedretti
2010-02-04 23:13         ` David Miller
2010-02-05  0:36           ` Kevin Pedretti
2010-02-05  1:04             ` David Miller
2010-02-04 23:16         ` Alan Cox
2010-02-05  0:59           ` Kevin Pedretti
2010-02-03 16:12     ` Randy Dunlap
2010-02-02 21:59 ` Randy Dunlap
2010-02-02 22:12   ` Ben Hutchings
2010-02-02 23:38 ` Stephen Hemminger [this message]
2010-02-03  1:08 ` [PATCH] seastar - SeaStar Ethernet driver (review comments addressed) Kevin Pedretti
2010-02-03  1:39   ` Stephen Hemminger
2010-02-03  2:02   ` Joe Perches
2010-02-03  2:07     ` Stephen Hemminger

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=20100202153804.6aa49835@nehalam \
    --to=shemminger@vyatta.com \
    --cc=ktpedre@sandia.gov \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 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).