Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134351
b: refs/heads/master
c: 409f0a9
h: refs/heads/master
i:
  134349: 75db5df
  134347: f5ed068
  134343: 92d3af7
  134335: 0547c32
v: v3
  • Loading branch information
David S. Miller committed Feb 7, 2009
1 parent dbf1773 commit bcda6ac
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 91 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: 593721833d2a3987736467144ad062a709d3a72c
refs/heads/master: 409f0a9014fe24d906ba21aaccff80eb7f7304da
1 change: 1 addition & 0 deletions trunk/drivers/net/3c509.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,7 @@ el3_resume(struct device *pdev)
spin_lock_irqsave(&lp->lock, flags);

outw(PowerUp, ioaddr + EL3_CMD);
EL3WINDOW(0);
el3_up(dev);

if (netif_running(dev))
Expand Down
93 changes: 58 additions & 35 deletions trunk/drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,22 @@ enum features {
RTL_FEATURE_GMII = (1 << 2),
};

struct rtl8169_counters {
__le64 tx_packets;
__le64 rx_packets;
__le64 tx_errors;
__le32 rx_errors;
__le16 rx_missed;
__le16 align_errors;
__le32 tx_one_collision;
__le32 tx_multi_collision;
__le64 rx_unicast;
__le64 rx_broadcast;
__le32 rx_multicast;
__le16 tx_aborted;
__le16 tx_underun;
};

struct rtl8169_private {
void __iomem *mmio_addr; /* memory map physical address */
struct pci_dev *pci_dev; /* Index of PCI device */
Expand Down Expand Up @@ -480,6 +496,7 @@ struct rtl8169_private {
unsigned features;

struct mii_if_info mii;
struct rtl8169_counters counters;
};

MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
Expand Down Expand Up @@ -1100,22 +1117,6 @@ static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = {
"tx_underrun",
};

struct rtl8169_counters {
__le64 tx_packets;
__le64 rx_packets;
__le64 tx_errors;
__le32 rx_errors;
__le16 rx_missed;
__le16 align_errors;
__le32 tx_one_collision;
__le32 tx_multi_collision;
__le64 rx_unicast;
__le64 rx_broadcast;
__le32 rx_multicast;
__le16 tx_aborted;
__le16 tx_underun;
};

static int rtl8169_get_sset_count(struct net_device *dev, int sset)
{
switch (sset) {
Expand All @@ -1126,16 +1127,21 @@ static int rtl8169_get_sset_count(struct net_device *dev, int sset)
}
}

static void rtl8169_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
static void rtl8169_update_counters(struct net_device *dev)
{
struct rtl8169_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr;
struct rtl8169_counters *counters;
dma_addr_t paddr;
u32 cmd;
int wait = 1000;

ASSERT_RTNL();
/*
* Some chips are unable to dump tally counters when the receiver
* is disabled.
*/
if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0)
return;

counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr);
if (!counters)
Expand All @@ -1146,31 +1152,45 @@ static void rtl8169_get_ethtool_stats(struct net_device *dev,
RTL_W32(CounterAddrLow, cmd);
RTL_W32(CounterAddrLow, cmd | CounterDump);

while (RTL_R32(CounterAddrLow) & CounterDump) {
if (msleep_interruptible(1))
while (wait--) {
if ((RTL_R32(CounterAddrLow) & CounterDump) == 0) {
/* copy updated counters */
memcpy(&tp->counters, counters, sizeof(*counters));
break;
}
udelay(10);
}

RTL_W32(CounterAddrLow, 0);
RTL_W32(CounterAddrHigh, 0);

data[0] = le64_to_cpu(counters->tx_packets);
data[1] = le64_to_cpu(counters->rx_packets);
data[2] = le64_to_cpu(counters->tx_errors);
data[3] = le32_to_cpu(counters->rx_errors);
data[4] = le16_to_cpu(counters->rx_missed);
data[5] = le16_to_cpu(counters->align_errors);
data[6] = le32_to_cpu(counters->tx_one_collision);
data[7] = le32_to_cpu(counters->tx_multi_collision);
data[8] = le64_to_cpu(counters->rx_unicast);
data[9] = le64_to_cpu(counters->rx_broadcast);
data[10] = le32_to_cpu(counters->rx_multicast);
data[11] = le16_to_cpu(counters->tx_aborted);
data[12] = le16_to_cpu(counters->tx_underun);

pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr);
}

static void rtl8169_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
struct rtl8169_private *tp = netdev_priv(dev);

ASSERT_RTNL();

rtl8169_update_counters(dev);

data[0] = le64_to_cpu(tp->counters.tx_packets);
data[1] = le64_to_cpu(tp->counters.rx_packets);
data[2] = le64_to_cpu(tp->counters.tx_errors);
data[3] = le32_to_cpu(tp->counters.rx_errors);
data[4] = le16_to_cpu(tp->counters.rx_missed);
data[5] = le16_to_cpu(tp->counters.align_errors);
data[6] = le32_to_cpu(tp->counters.tx_one_collision);
data[7] = le32_to_cpu(tp->counters.tx_multi_collision);
data[8] = le64_to_cpu(tp->counters.rx_unicast);
data[9] = le64_to_cpu(tp->counters.rx_broadcast);
data[10] = le32_to_cpu(tp->counters.rx_multicast);
data[11] = le16_to_cpu(tp->counters.tx_aborted);
data[12] = le16_to_cpu(tp->counters.tx_underun);
}

static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data)
{
switch(stringset) {
Expand Down Expand Up @@ -3682,6 +3702,9 @@ static int rtl8169_close(struct net_device *dev)
struct rtl8169_private *tp = netdev_priv(dev);
struct pci_dev *pdev = tp->pci_dev;

/* update counters before going down */
rtl8169_update_counters(dev);

rtl8169_down(dev);

free_irq(dev->irq, dev);
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/sungem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,8 @@ static int gem_do_start(struct net_device *dev)

gp->running = 1;

napi_enable(&gp->napi);

if (gp->lstate == link_up) {
netif_carrier_on(gp->dev);
gem_set_link_modes(gp);
Expand All @@ -2238,6 +2240,8 @@ static int gem_do_start(struct net_device *dev)
spin_lock_irqsave(&gp->lock, flags);
spin_lock(&gp->tx_lock);

napi_disable(&gp->napi);

gp->running = 0;
gem_reset(gp);
gem_clean_rings(gp);
Expand Down Expand Up @@ -2338,8 +2342,6 @@ static int gem_open(struct net_device *dev)
if (!gp->asleep)
rc = gem_do_start(dev);
gp->opened = (rc == 0);
if (gp->opened)
napi_enable(&gp->napi);

mutex_unlock(&gp->pm_mutex);

Expand Down Expand Up @@ -2476,8 +2478,6 @@ static int gem_resume(struct pci_dev *pdev)

/* Re-attach net device */
netif_device_attach(dev);

napi_enable(&gp->napi);
}

spin_lock_irqsave(&gp->lock, flags);
Expand Down
12 changes: 8 additions & 4 deletions trunk/drivers/net/sunhme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2629,6 +2629,14 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
int i, qfe_slot = -1;
int err = -ENODEV;

sbus_dp = to_of_device(op->dev.parent)->node;
if (is_qfe)
sbus_dp = to_of_device(op->dev.parent->parent)->node;

/* We can match PCI devices too, do not accept those here. */
if (strcmp(sbus_dp->name, "sbus"))
return err;

if (is_qfe) {
qp = quattro_sbus_find(op);
if (qp == NULL)
Expand Down Expand Up @@ -2734,10 +2742,6 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
if (qp != NULL)
hp->happy_flags |= HFLAG_QUATTRO;

sbus_dp = to_of_device(op->dev.parent)->node;
if (is_qfe)
sbus_dp = to_of_device(op->dev.parent->parent)->node;

/* Get the supported DVMA burst sizes from our Happy SBUS. */
hp->happy_bursts = of_getintprop_default(sbus_dp,
"burst-sizes", 0x00);
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ void iwl_clear_stations_table(struct iwl_priv *priv)
priv->num_stations = 0;
memset(priv->stations, 0, sizeof(priv->stations));

/* clean ucode key table bit map */
priv->ucode_key_table = 0;

spin_unlock_irqrestore(&priv->sta_lock, flags);
}
EXPORT_SYMBOL(iwl_clear_stations_table);
Expand Down
12 changes: 12 additions & 0 deletions trunk/include/linux/dmaengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,18 @@ static inline void dmaengine_put(void)
}
#endif

#ifdef CONFIG_NET_DMA
#define net_dmaengine_get() dmaengine_get()
#define net_dmaengine_put() dmaengine_put()
#else
static inline void net_dmaengine_get(void)
{
}
static inline void net_dmaengine_put(void)
{
}
#endif

dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
void *dest, void *src, size_t len);
dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
Expand Down
22 changes: 13 additions & 9 deletions trunk/net/9p/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
#include "protocol.h"
Expand Down Expand Up @@ -160,29 +161,32 @@ p9pdu_vreadf(struct p9_fcall *pdu, int optional, const char *fmt, va_list ap)
break;
case 'w':{
int16_t *val = va_arg(ap, int16_t *);
if (pdu_read(pdu, val, sizeof(*val))) {
__le16 le_val;
if (pdu_read(pdu, &le_val, sizeof(le_val))) {
errcode = -EFAULT;
break;
}
*val = cpu_to_le16(*val);
*val = le16_to_cpu(le_val);
}
break;
case 'd':{
int32_t *val = va_arg(ap, int32_t *);
if (pdu_read(pdu, val, sizeof(*val))) {
__le32 le_val;
if (pdu_read(pdu, &le_val, sizeof(le_val))) {
errcode = -EFAULT;
break;
}
*val = cpu_to_le32(*val);
*val = le32_to_cpu(le_val);
}
break;
case 'q':{
int64_t *val = va_arg(ap, int64_t *);
if (pdu_read(pdu, val, sizeof(*val))) {
__le64 le_val;
if (pdu_read(pdu, &le_val, sizeof(le_val))) {
errcode = -EFAULT;
break;
}
*val = cpu_to_le64(*val);
*val = le64_to_cpu(le_val);
}
break;
case 's':{
Expand Down Expand Up @@ -362,19 +366,19 @@ p9pdu_vwritef(struct p9_fcall *pdu, int optional, const char *fmt, va_list ap)
}
break;
case 'w':{
int16_t val = va_arg(ap, int);
__le16 val = cpu_to_le16(va_arg(ap, int));
if (pdu_write(pdu, &val, sizeof(val)))
errcode = -EFAULT;
}
break;
case 'd':{
int32_t val = va_arg(ap, int32_t);
__le32 val = cpu_to_le32(va_arg(ap, int32_t));
if (pdu_write(pdu, &val, sizeof(val)))
errcode = -EFAULT;
}
break;
case 'q':{
int64_t val = va_arg(ap, int64_t);
__le64 val = cpu_to_le64(va_arg(ap, int64_t));
if (pdu_write(pdu, &val, sizeof(val)))
errcode = -EFAULT;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ int dev_open(struct net_device *dev)
/*
* Enable NET_DMA
*/
dmaengine_get();
net_dmaengine_get();

/*
* Initialize multicasting status
Expand Down Expand Up @@ -1187,7 +1187,7 @@ int dev_close(struct net_device *dev)
/*
* Shutdown NET_DMA
*/
dmaengine_put();
net_dmaengine_put();

return 0;
}
Expand Down
14 changes: 8 additions & 6 deletions trunk/net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,15 +1994,17 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
if (!net_eq(neigh_parms_net(p), net))
continue;

if (nidx++ < neigh_skip)
continue;
if (nidx < neigh_skip)
goto next;

if (neightbl_fill_param_info(skb, tbl, p,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq,
RTM_NEWNEIGHTBL,
NLM_F_MULTI) <= 0)
goto out;
next:
nidx++;
}

neigh_skip = 0;
Expand Down Expand Up @@ -2082,12 +2084,10 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
if (h > s_h)
s_idx = 0;
for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
int lidx;
if (dev_net(n->dev) != net)
continue;
lidx = idx++;
if (lidx < s_idx)
continue;
if (idx < s_idx)
goto next;
if (neigh_fill_info(skb, n, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq,
RTM_NEWNEIGH,
Expand All @@ -2096,6 +2096,8 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
rc = -1;
goto out;
}
next:
idx++;
}
}
read_unlock_bh(&tbl->lock);
Expand Down
Loading

0 comments on commit bcda6ac

Please sign in to comment.