Skip to content

Commit

Permalink
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jgarzik/netdev-2.6

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (89 commits)
  myri10ge: update driver version
  myri10ge: report when the link partner is running in Myrinet mode
  myri10ge: limit the number of recoveries
  NetXen: Fix link status messages
  Revert "[netdrvr e100] experiment with doing RX in a similar manner to eepro100"
  [PATCH] libertas: convert libertas_mpp into anycast_mask
  [PATCH] libertas: actually send mesh frames to mesh netdev
  [PATCH] libertas: deauthenticate from AP in channel switch
  [PATCH] libertas: pull current channel from firmware on mesh autostart
  [PATCH] libertas: reduce SSID and BSSID mixed-case abuse
  [PATCH] libertas: remove WPA_SUPPLICANT structure
  [PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid
  [PATCH] libertas: tweak association debug output
  [PATCH] libertas: fix big-endian associate command.
  [PATCH] libertas: don't byte-swap firmware version number. It's a byte array.
  [PATCH] libertas: more endianness fixes, in tx.c this time
  [PATCH] libertas: More endianness fixes.
  [PATCH] libertas: first pass at fixing up endianness issues
  [PATCH] libertas: sparse fixes
  [PATCH] libertas: fix character set in README
  ...
  • Loading branch information
Linus Torvalds committed Jun 13, 2007
2 parents dd14cbc + b232923 commit a0e1d1d
Show file tree
Hide file tree
Showing 49 changed files with 4,001 additions and 3,778 deletions.
72 changes: 63 additions & 9 deletions drivers/net/e100.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ enum scb_status {
rus_mask = 0x3C,
};

enum ru_state {
RU_SUSPENDED = 0,
RU_RUNNING = 1,
RU_UNINITIALIZED = -1,
};

enum scb_stat_ack {
stat_ack_not_ours = 0x00,
stat_ack_sw_gen = 0x04,
Expand Down Expand Up @@ -526,6 +532,7 @@ struct nic {
struct rx *rx_to_use;
struct rx *rx_to_clean;
struct rfd blank_rfd;
enum ru_state ru_running;

spinlock_t cb_lock ____cacheline_aligned;
spinlock_t cmd_lock;
Expand Down Expand Up @@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic)
((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));

/* Template for a freshly allocated RFD */
nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s);
nic->blank_rfd.command = cpu_to_le16(cb_el);
nic->blank_rfd.rbd = 0xFFFFFFFF;
nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);

Expand Down Expand Up @@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic)
return 0;
}

static inline void e100_start_receiver(struct nic *nic)
static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
{
/* Start if RFA is non-NULL */
if(nic->rx_to_clean->skb)
e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr);
if(!nic->rxs) return;
if(RU_SUSPENDED != nic->ru_running) return;

/* handle init time starts */
if(!rx) rx = nic->rxs;

/* (Re)start RU if suspended or idle and RFA is non-NULL */
if(rx->skb) {
e100_exec_cmd(nic, ruc_start, rx->dma_addr);
nic->ru_running = RU_RUNNING;
}
}

#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
Expand Down Expand Up @@ -1775,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
put_unaligned(cpu_to_le32(rx->dma_addr),
(u32 *)&prev_rfd->link);
wmb();
prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s);
prev_rfd->command &= ~cpu_to_le16(cb_el);
pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
sizeof(struct rfd), PCI_DMA_TODEVICE);
}
Expand Down Expand Up @@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
pci_unmap_single(nic->pdev, rx->dma_addr,
RFD_BUF_LEN, PCI_DMA_FROMDEVICE);

/* this allows for a fast restart without re-enabling interrupts */
if(le16_to_cpu(rfd->command) & cb_el)
nic->ru_running = RU_SUSPENDED;

/* Pull off the RFD and put the actual data (minus eth hdr) */
skb_reserve(skb, sizeof(struct rfd));
skb_put(skb, actual_size);
Expand Down Expand Up @@ -1843,25 +1862,54 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
unsigned int work_to_do)
{
struct rx *rx;
int restart_required = 0;
struct rx *rx_to_start = NULL;

/* are we already rnr? then pay attention!!! this ensures that
* the state machine progression never allows a start with a
* partially cleaned list, avoiding a race between hardware
* and rx_to_clean when in NAPI mode */
if(RU_SUSPENDED == nic->ru_running)
restart_required = 1;

/* Indicate newly arrived packets */
for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
if(e100_rx_indicate(nic, rx, work_done, work_to_do))
int err = e100_rx_indicate(nic, rx, work_done, work_to_do);
if(-EAGAIN == err) {
/* hit quota so have more work to do, restart once
* cleanup is complete */
restart_required = 0;
break;
} else if(-ENODATA == err)
break; /* No more to clean */
}

/* save our starting point as the place we'll restart the receiver */
if(restart_required)
rx_to_start = nic->rx_to_clean;

/* Alloc new skbs to refill list */
for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
if(unlikely(e100_rx_alloc_skb(nic, rx)))
break; /* Better luck next time (see watchdog) */
}

if(restart_required) {
// ack the rnr?
writeb(stat_ack_rnr, &nic->csr->scb.stat_ack);
e100_start_receiver(nic, rx_to_start);
if(work_done)
(*work_done)++;
}
}

static void e100_rx_clean_list(struct nic *nic)
{
struct rx *rx;
unsigned int i, count = nic->params.rfds.count;

nic->ru_running = RU_UNINITIALIZED;

if(nic->rxs) {
for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
if(rx->skb) {
Expand All @@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic)
unsigned int i, count = nic->params.rfds.count;

nic->rx_to_use = nic->rx_to_clean = NULL;
nic->ru_running = RU_UNINITIALIZED;

if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
return -ENOMEM;
Expand All @@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic)
}

nic->rx_to_use = nic->rx_to_clean = nic->rxs;
nic->ru_running = RU_SUSPENDED;

return 0;
}
Expand All @@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
/* Ack interrupt(s) */
iowrite8(stat_ack, &nic->csr->scb.stat_ack);

/* We hit Receive No Resource (RNR); restart RU after cleaning */
if(stat_ack & stat_ack_rnr)
nic->ru_running = RU_SUSPENDED;

if(likely(netif_rx_schedule_prep(netdev))) {
e100_disable_irq(nic);
__netif_rx_schedule(netdev);
Expand Down Expand Up @@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic)
if((err = e100_hw_init(nic)))
goto err_clean_cbs;
e100_set_multicast_list(nic->netdev);
e100_start_receiver(nic);
e100_start_receiver(nic, NULL);
mod_timer(&nic->watchdog, jiffies);
if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
nic->netdev->name, nic->netdev)))
Expand Down Expand Up @@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
BMCR_LOOPBACK);

e100_start_receiver(nic);
e100_start_receiver(nic, NULL);

if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
err = -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ehea/ehea.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <asm/io.h>

#define DRV_NAME "ehea"
#define DRV_VERSION "EHEA_0061"
#define DRV_VERSION "EHEA_0064"

#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
Expand Down
12 changes: 5 additions & 7 deletions drivers/net/ehea/ehea_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev,
processed_rq3++;
}

if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
&& port->vgrp)
vlan_hwaccel_receive_skb(skb, port->vgrp,
cqe->vlan_tag);
else
Expand Down Expand Up @@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
goto out;
}

if (grp)
memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
else
memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter));
memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));

hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
Expand Down Expand Up @@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
}

index = (vid / 64);
cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F)));
cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F)));

hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
Expand Down Expand Up @@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
}

index = (vid / 64);
cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F)));
cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F)));

hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
H_PORT_CB1, H_PORT_CB1_ALL, cb1);
Expand Down
80 changes: 54 additions & 26 deletions drivers/net/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
{
struct ibmveth_adapter *adapter = dev->priv;
int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
int i;
int reinit = 0;
int i, rc;

if (new_mtu < IBMVETH_MAX_MTU)
return -EINVAL;

for (i = 0; i < IbmVethNumBufferPools; i++)
if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size)
break;

if (i == IbmVethNumBufferPools)
return -EINVAL;

/* Look for an active buffer pool that can hold the new MTU */
for(i = 0; i<IbmVethNumBufferPools; i++) {
if (!adapter->rx_buff_pool[i].active)
continue;
if (!adapter->rx_buff_pool[i].active) {
adapter->rx_buff_pool[i].active = 1;
reinit = 1;
}

if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
dev->mtu = new_mtu;
if (reinit && netif_running(adapter->netdev)) {
adapter->pool_config = 1;
ibmveth_close(adapter->netdev);
adapter->pool_config = 0;
dev->mtu = new_mtu;
if ((rc = ibmveth_open(adapter->netdev)))
return rc;
} else
dev->mtu = new_mtu;
return 0;
}
}
Expand Down Expand Up @@ -1243,16 +1262,19 @@ const char * buf, size_t count)

if (attr == &veth_active_attr) {
if (value && !pool->active) {
if(ibmveth_alloc_buffer_pool(pool)) {
ibmveth_error_printk("unable to alloc pool\n");
return -ENOMEM;
}
pool->active = 1;
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
if ((rc = ibmveth_open(netdev)))
return rc;
if (netif_running(netdev)) {
if(ibmveth_alloc_buffer_pool(pool)) {
ibmveth_error_printk("unable to alloc pool\n");
return -ENOMEM;
}
pool->active = 1;
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
if ((rc = ibmveth_open(netdev)))
return rc;
} else
pool->active = 1;
} else if (!value && pool->active) {
int mtu = netdev->mtu + IBMVETH_BUFF_OH;
int i;
Expand Down Expand Up @@ -1281,23 +1303,29 @@ const char * buf, size_t count)
if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
return -EINVAL;
else {
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
pool->size = value;
if ((rc = ibmveth_open(netdev)))
return rc;
if (netif_running(netdev)) {
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
pool->size = value;
if ((rc = ibmveth_open(netdev)))
return rc;
} else
pool->size = value;
}
} else if (attr == &veth_size_attr) {
if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
return -EINVAL;
else {
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
pool->buff_size = value;
if ((rc = ibmveth_open(netdev)))
return rc;
if (netif_running(netdev)) {
adapter->pool_config = 1;
ibmveth_close(netdev);
adapter->pool_config = 0;
pool->buff_size = value;
if ((rc = ibmveth_open(netdev)))
return rc;
} else
pool->buff_size = value;
}
}

Expand Down
Loading

0 comments on commit a0e1d1d

Please sign in to comment.