From: Jeff Garzik <jeff@garzik.org>
To: "Linsys Contractor Amit S. Kale" <amitkale@unminc.com>
Cc: netdev@vger.kernel.org, sanjeev@netxen.com, unmproj@linsyssoft.com
Subject: Re: [PATCH 2.6.17 1/9] NetXen: Makefile and ethtool interface
Date: Wed, 05 Jul 2006 11:34:51 -0400 [thread overview]
Message-ID: <44ABDC1B.4020504@garzik.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0607050616110.27969@dut46>
Linsys Contractor Amit S. Kale wrote:
> +static int
> +netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
> +{
> + struct netxen_port *port = netdev_priv(dev);
> + struct netxen_adapter *adapter = port->adapter;
> + struct netxen_niu_phy_status status;
> +
> + /* read which mode */
> + if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
> + /* autonegotiation */
> + if (netxen_nic_phy_write(port->adapter, port->portnum,
> + NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
> + (netxen_crbword_t) ecmd->autoneg) != 0)
> + return -EIO;
> + else
> + port->link_autoneg = ecmd->autoneg;
> +
> + if (netxen_nic_phy_read(port->adapter, port->portnum,
> + NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
> + (netxen_crbword_t *) & status) != 0)
> + return -EIO;
> +
> + /* speed */
> + switch (ecmd->speed) {
> + case SPEED_10:
> + status.speed = 0;
> + break;
> + case SPEED_100:
> + status.speed = 1;
> + break;
> + case SPEED_1000:
> + status.speed = 2;
> + break;
> + }
> + /* set duplex mode */
> + if (ecmd->duplex == DUPLEX_HALF)
> + status.duplex = 0;
> + if (ecmd->duplex == DUPLEX_FULL)
> + status.duplex = 1;
> +
> + if (netxen_nic_phy_write(port->adapter, port->portnum,
> + NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
> + *((int *)&status)) != 0)
> + return -EIO;
> + else {
> + port->link_speed = ecmd->speed;
> + port->link_duplex = ecmd->duplex;
> + }
> + }
> + if (netif_running(dev)) {
> + dev->stop(dev);
> + dev->open(dev);
> + }
> + return 0;
> +}
> +
> +/* Restart Link Process */
> +static int netxen_nic_nway_reset(struct net_device *dev)
> +{
> + if (netif_running(dev)) {
> + dev->stop(dev); /* verify */
> + dev->open(dev);
> + }
> + return 0;
> +}
Direct calls to dev->stop() and dev->open() are likely buggy, because
the locking/context differs between the above quoted calls and the calls
from inside the net stack.
> +struct ethtool_ops netxen_nic_ethtool_ops = {
> + .get_settings = netxen_nic_get_settings,
> + .set_settings = netxen_nic_set_settings,
> + .get_drvinfo = netxen_nic_get_drvinfo,
> + .get_regs_len = netxen_nic_get_regs_len,
> + .get_regs = netxen_nic_get_regs,
> + .get_wol = netxen_nic_get_wol,
> + .nway_reset = netxen_nic_nway_reset,
> + .get_link = netxen_nic_get_link,
> + .get_eeprom_len = netxen_nic_get_eeprom_len,
> + .get_eeprom = netxen_nic_get_eeprom,
> + .get_ringparam = netxen_nic_get_ringparam,
> + .get_pauseparam = netxen_nic_get_pauseparam,
> + .set_pauseparam = netxen_nic_set_pauseparam,
> + .get_tx_csum = ethtool_op_get_tx_csum,
> + .set_tx_csum = ethtool_op_set_tx_csum,
> + .get_sg = ethtool_op_get_sg,
> + .set_sg = ethtool_op_set_sg,
> +#ifdef NETIF_F_TSO
> + .get_tso = ethtool_op_get_tso,
> + .set_tso = ethtool_op_set_tso,
> +#endif
kill this #ifdef
Jeff
next prev parent reply other threads:[~2006-07-05 15:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 13:15 [PATCH 2.6.17 0/9] NetXen: ethernet nic driver Linsys Contractor Amit S. Kale
2006-07-05 13:20 ` [PATCH 2.6.17 1/9] NetXen: Makefile and ethtool interface Linsys Contractor Amit S. Kale
2006-07-05 15:34 ` Jeff Garzik [this message]
2006-07-06 13:50 ` Pradeep Dalvi
2006-07-05 13:29 ` [PATCH 2.6.17 2/9] NetXen: Main header file Linsys Contractor Amit S. Kale
2006-07-05 15:46 ` Jeff Garzik
2006-07-05 13:31 ` [PATCH 2.6.17 3/9] NetXen: Registers info " Linsys Contractor Amit S. Kale
2006-07-05 15:51 ` Jeff Garzik
2006-07-05 13:34 ` [PATCH 2.6.17 4/9] NetXen: hardware access routines Linsys Contractor Amit S. Kale
2006-07-05 16:00 ` Jeff Garzik
2006-07-05 13:38 ` [PATCH 2.6.17 5/9] NetXen: hardware access header file Linsys Contractor Amit S. Kale
2006-07-05 16:04 ` Jeff Garzik
2006-07-05 13:40 ` [PATCH 2.6.17 6/9] NetXen: hw initialization routines Linsys Contractor Amit S. Kale
2006-07-05 16:12 ` Jeff Garzik
2006-07-05 13:42 ` [PATCH 2.6.17 7/9] NetXen: ioctl interface and intr routines Linsys Contractor Amit S. Kale
2006-07-05 13:44 ` [PATCH 2.6.17 8/9] NetXen: Driver main file Linsys Contractor Amit S. Kale
2006-07-05 13:47 ` [PATCH 2.6.17 9/9] NetXen: niu handling and CRB reg definitions Linsys Contractor Amit S. Kale
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=44ABDC1B.4020504@garzik.org \
--to=jeff@garzik.org \
--cc=amitkale@unminc.com \
--cc=netdev@vger.kernel.org \
--cc=sanjeev@netxen.com \
--cc=unmproj@linsyssoft.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).