Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135378
b: refs/heads/master
c: 687c75d
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Mar 22, 2009
1 parent abc9a04 commit 3d29bb2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dde09758557120cb71fb760cfeaed1b8e27209ef
refs/heads/master: 687c75dcf342f71329bd193af553e96a29581238
41 changes: 19 additions & 22 deletions trunk/drivers/infiniband/hw/amso1100/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static irqreturn_t c2_interrupt(int irq, void *dev_id);
static void c2_tx_timeout(struct net_device *netdev);
static int c2_change_mtu(struct net_device *netdev, int new_mtu);
static void c2_reset(struct c2_port *c2_port);
static struct net_device_stats *c2_get_stats(struct net_device *netdev);

static struct pci_device_id c2_pci_table[] = {
{ PCI_DEVICE(0x18b8, 0xb001) },
Expand Down Expand Up @@ -349,7 +348,7 @@ static void c2_tx_clean(struct c2_port *c2_port)
elem->hw_desc + C2_TXP_ADDR);
__raw_writew((__force u16) cpu_to_be16(TXP_HTXD_DONE),
elem->hw_desc + C2_TXP_FLAGS);
c2_port->netstats.tx_dropped++;
c2_port->netdev->stats.tx_dropped++;
break;
} else {
__raw_writew(0,
Expand Down Expand Up @@ -457,7 +456,7 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem)
elem->hw_desc + C2_RXP_FLAGS);

pr_debug("packet dropped\n");
c2_port->netstats.rx_dropped++;
c2_port->netdev->stats.rx_dropped++;
}

static void c2_rx_interrupt(struct net_device *netdev)
Expand Down Expand Up @@ -532,8 +531,8 @@ static void c2_rx_interrupt(struct net_device *netdev)
netif_rx(skb);

netdev->last_rx = jiffies;
c2_port->netstats.rx_packets++;
c2_port->netstats.rx_bytes += buflen;
netdev->stats.rx_packets++;
netdev->stats.rx_bytes += buflen;
}

/* Save where we left off */
Expand Down Expand Up @@ -797,8 +796,8 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
__raw_writew((__force u16) cpu_to_be16(TXP_HTXD_READY),
elem->hw_desc + C2_TXP_FLAGS);

c2_port->netstats.tx_packets++;
c2_port->netstats.tx_bytes += maplen;
netdev->stats.tx_packets++;
netdev->stats.tx_bytes += maplen;

/* Loop thru additional data fragments and queue them */
if (skb_shinfo(skb)->nr_frags) {
Expand All @@ -823,8 +822,8 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
__raw_writew((__force u16) cpu_to_be16(TXP_HTXD_READY),
elem->hw_desc + C2_TXP_FLAGS);

c2_port->netstats.tx_packets++;
c2_port->netstats.tx_bytes += maplen;
netdev->stats.tx_packets++;
netdev->stats.tx_bytes += maplen;
}
}

Expand All @@ -845,13 +844,6 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK;
}

static struct net_device_stats *c2_get_stats(struct net_device *netdev)
{
struct c2_port *c2_port = netdev_priv(netdev);

return &c2_port->netstats;
}

static void c2_tx_timeout(struct net_device *netdev)
{
struct c2_port *c2_port = netdev_priv(netdev);
Expand Down Expand Up @@ -880,6 +872,16 @@ static int c2_change_mtu(struct net_device *netdev, int new_mtu)
return ret;
}

static const struct net_device_ops c2_netdev = {
.ndo_open = c2_up,
.ndo_stop = c2_down,
.ndo_start_xmit = c2_xmit_frame,
.ndo_tx_timeout = c2_tx_timeout,
.ndo_change_mtu = c2_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};

/* Initialize network device */
static struct net_device *c2_devinit(struct c2_dev *c2dev,
void __iomem * mmio_addr)
Expand All @@ -894,12 +896,7 @@ static struct net_device *c2_devinit(struct c2_dev *c2dev,

SET_NETDEV_DEV(netdev, &c2dev->pcidev->dev);

netdev->open = c2_up;
netdev->stop = c2_down;
netdev->hard_start_xmit = c2_xmit_frame;
netdev->get_stats = c2_get_stats;
netdev->tx_timeout = c2_tx_timeout;
netdev->change_mtu = c2_change_mtu;
netdev->netdev_ops = &c2_netdev;
netdev->watchdog_timeo = C2_TX_TIMEOUT;
netdev->irq = c2dev->pcidev->irq;

Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/infiniband/hw/amso1100/c2.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ struct c2_port {
unsigned long mem_size;

u32 rx_buf_size;

struct net_device_stats netstats;
};

/*
Expand Down
22 changes: 11 additions & 11 deletions trunk/drivers/infiniband/hw/amso1100/c2_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,34 +708,34 @@ static int c2_pseudo_xmit_frame(struct sk_buff *skb, struct net_device *netdev)

static int c2_pseudo_change_mtu(struct net_device *netdev, int new_mtu)
{
int ret = 0;

if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
return -EINVAL;

netdev->mtu = new_mtu;

/* TODO: Tell rnic about new rmda interface mtu */
return ret;
return 0;
}

static const struct net_device_ops c2_pseudo_netdev_ops = {
.ndo_open = c2_pseudo_up,
.ndo_stop = c2_pseudo_down,
.ndo_start_xmit = c2_pseudo_xmit_frame,
.ndo_change_mtu = c2_pseudo_change_mtu,
.ndo_validate_addr = eth_validate_addr,
};

static void setup(struct net_device *netdev)
{
netdev->open = c2_pseudo_up;
netdev->stop = c2_pseudo_down;
netdev->hard_start_xmit = c2_pseudo_xmit_frame;
netdev->get_stats = NULL;
netdev->tx_timeout = NULL;
netdev->set_mac_address = NULL;
netdev->change_mtu = c2_pseudo_change_mtu;
netdev->netdev_ops = &c2_pseudo_netdev_ops;

netdev->watchdog_timeo = 0;
netdev->type = ARPHRD_ETHER;
netdev->mtu = 1500;
netdev->hard_header_len = ETH_HLEN;
netdev->addr_len = ETH_ALEN;
netdev->tx_queue_len = 0;
netdev->flags |= IFF_NOARP;
return;
}

static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)
Expand Down

0 comments on commit 3d29bb2

Please sign in to comment.