You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (55 commits) netxen: fix tx ring accounting netxen: fix detection of cut-thru firmware mode forcedeth: fix dma api mismatches atm: sk_wmem_alloc initial value is one net: correct off-by-one write allocations reports via-velocity : fix no link detection on boot Net / e100: Fix suspend of devices that cannot be power managed TI DaVinci EMAC : Fix rmmod error net: group address list and its count ipv4: Fix fib_trie rebalancing, part 2 pkt_sched: Update drops stats in act_police sky2: version 1.23 sky2: add GRO support sky2: skb recycling sky2: reduce default transmit ring sky2: receive counter update sky2: fix shutdown synchronization sky2: PCI irq issues sky2: more receive shutdown sky2: turn off pause during shutdown ... Manually fix trivial conflict in net/core/skbuff.c due to kmemcheck
This commit is contained in:
+69
-68
@@ -3,9 +3,8 @@ rfkill - RF kill switch support
|
||||
|
||||
1. Introduction
|
||||
2. Implementation details
|
||||
3. Kernel driver guidelines
|
||||
4. Kernel API
|
||||
5. Userspace support
|
||||
3. Kernel API
|
||||
4. Userspace support
|
||||
|
||||
|
||||
1. Introduction
|
||||
@@ -19,82 +18,62 @@ disable all transmitters of a certain type (or all). This is intended for
|
||||
situations where transmitters need to be turned off, for example on
|
||||
aircraft.
|
||||
|
||||
The rfkill subsystem has a concept of "hard" and "soft" block, which
|
||||
differ little in their meaning (block == transmitters off) but rather in
|
||||
whether they can be changed or not:
|
||||
- hard block: read-only radio block that cannot be overriden by software
|
||||
- soft block: writable radio block (need not be readable) that is set by
|
||||
the system software.
|
||||
|
||||
|
||||
2. Implementation details
|
||||
|
||||
The rfkill subsystem is composed of various components: the rfkill class, the
|
||||
rfkill-input module (an input layer handler), and some specific input layer
|
||||
events.
|
||||
The rfkill subsystem is composed of three main components:
|
||||
* the rfkill core,
|
||||
* the deprecated rfkill-input module (an input layer handler, being
|
||||
replaced by userspace policy code) and
|
||||
* the rfkill drivers.
|
||||
|
||||
The rfkill class is provided for kernel drivers to register their radio
|
||||
transmitter with the kernel, provide methods for turning it on and off and,
|
||||
optionally, letting the system know about hardware-disabled states that may
|
||||
be implemented on the device. This code is enabled with the CONFIG_RFKILL
|
||||
Kconfig option, which drivers can "select".
|
||||
The rfkill core provides API for kernel drivers to register their radio
|
||||
transmitter with the kernel, methods for turning it on and off and, letting
|
||||
the system know about hardware-disabled states that may be implemented on
|
||||
the device.
|
||||
|
||||
The rfkill class code also notifies userspace of state changes, this is
|
||||
achieved via uevents. It also provides some sysfs files for userspace to
|
||||
check the status of radio transmitters. See the "Userspace support" section
|
||||
below.
|
||||
|
||||
|
||||
The rfkill-input code implements a basic response to rfkill buttons -- it
|
||||
implements turning on/off all devices of a certain class (or all).
|
||||
The rfkill core code also notifies userspace of state changes, and provides
|
||||
ways for userspace to query the current states. See the "Userspace support"
|
||||
section below.
|
||||
|
||||
When the device is hard-blocked (either by a call to rfkill_set_hw_state()
|
||||
or from query_hw_block) set_block() will be invoked but drivers can well
|
||||
ignore the method call since they can use the return value of the function
|
||||
rfkill_set_hw_state() to sync the software state instead of keeping track
|
||||
of calls to set_block().
|
||||
or from query_hw_block) set_block() will be invoked for additional software
|
||||
block, but drivers can ignore the method call since they can use the return
|
||||
value of the function rfkill_set_hw_state() to sync the software state
|
||||
instead of keeping track of calls to set_block(). In fact, drivers should
|
||||
use the return value of rfkill_set_hw_state() unless the hardware actually
|
||||
keeps track of soft and hard block separately.
|
||||
|
||||
|
||||
The entire functionality is spread over more than one subsystem:
|
||||
|
||||
* The kernel input layer generates KEY_WWAN, KEY_WLAN etc. and
|
||||
SW_RFKILL_ALL -- when the user presses a button. Drivers for radio
|
||||
transmitters generally do not register to the input layer, unless the
|
||||
device really provides an input device (i.e. a button that has no
|
||||
effect other than generating a button press event)
|
||||
|
||||
* The rfkill-input code hooks up to these events and switches the soft-block
|
||||
of the various radio transmitters, depending on the button type.
|
||||
|
||||
* The rfkill drivers turn off/on their transmitters as requested.
|
||||
|
||||
* The rfkill class will generate userspace notifications (uevents) to tell
|
||||
userspace what the current state is.
|
||||
3. Kernel API
|
||||
|
||||
|
||||
|
||||
3. Kernel driver guidelines
|
||||
|
||||
|
||||
Drivers for radio transmitters normally implement only the rfkill class.
|
||||
These drivers may not unblock the transmitter based on own decisions, they
|
||||
should act on information provided by the rfkill class only.
|
||||
Drivers for radio transmitters normally implement an rfkill driver.
|
||||
|
||||
Platform drivers might implement input devices if the rfkill button is just
|
||||
that, a button. If that button influences the hardware then you need to
|
||||
implement an rfkill class instead. This also applies if the platform provides
|
||||
implement an rfkill driver instead. This also applies if the platform provides
|
||||
a way to turn on/off the transmitter(s).
|
||||
|
||||
During suspend/hibernation, transmitters should only be left enabled when
|
||||
wake-on wlan or similar functionality requires it and the device wasn't
|
||||
blocked before suspend/hibernate. Note that it may be necessary to update
|
||||
the rfkill subsystem's idea of what the current state is at resume time if
|
||||
the state may have changed over suspend.
|
||||
For some platforms, it is possible that the hardware state changes during
|
||||
suspend/hibernation, in which case it will be necessary to update the rfkill
|
||||
core with the current state is at resume time.
|
||||
|
||||
To create an rfkill driver, driver's Kconfig needs to have
|
||||
|
||||
depends on RFKILL || !RFKILL
|
||||
|
||||
4. Kernel API
|
||||
|
||||
To build a driver with rfkill subsystem support, the driver should depend on
|
||||
(or select) the Kconfig symbol RFKILL.
|
||||
|
||||
The hardware the driver talks to may be write-only (where the current state
|
||||
of the hardware is unknown), or read-write (where the hardware can be queried
|
||||
about its current state).
|
||||
to ensure the driver cannot be built-in when rfkill is modular. The !RFKILL
|
||||
case allows the driver to be built when rfkill is not configured, which which
|
||||
case all rfkill API can still be used but will be provided by static inlines
|
||||
which compile to almost nothing.
|
||||
|
||||
Calling rfkill_set_hw_state() when a state change happens is required from
|
||||
rfkill drivers that control devices that can be hard-blocked unless they also
|
||||
@@ -105,10 +84,33 @@ device). Don't do this unless you cannot get the event in any other way.
|
||||
|
||||
5. Userspace support
|
||||
|
||||
The following sysfs entries exist for every rfkill device:
|
||||
The recommended userspace interface to use is /dev/rfkill, which is a misc
|
||||
character device that allows userspace to obtain and set the state of rfkill
|
||||
devices and sets of devices. It also notifies userspace about device addition
|
||||
and removal. The API is a simple read/write API that is defined in
|
||||
linux/rfkill.h, with one ioctl that allows turning off the deprecated input
|
||||
handler in the kernel for the transition period.
|
||||
|
||||
Except for the one ioctl, communication with the kernel is done via read()
|
||||
and write() of instances of 'struct rfkill_event'. In this structure, the
|
||||
soft and hard block are properly separated (unlike sysfs, see below) and
|
||||
userspace is able to get a consistent snapshot of all rfkill devices in the
|
||||
system. Also, it is possible to switch all rfkill drivers (or all drivers of
|
||||
a specified type) into a state which also updates the default state for
|
||||
hotplugged devices.
|
||||
|
||||
After an application opens /dev/rfkill, it can read the current state of
|
||||
all devices, and afterwards can poll the descriptor for hotplug or state
|
||||
change events.
|
||||
|
||||
Applications must ignore operations (the "op" field) they do not handle,
|
||||
this allows the API to be extended in the future.
|
||||
|
||||
Additionally, each rfkill device is registered in sysfs and there has the
|
||||
following attributes:
|
||||
|
||||
name: Name assigned by driver to this key (interface or driver name).
|
||||
type: Name of the key type ("wlan", "bluetooth", etc).
|
||||
type: Driver type string ("wlan", "bluetooth", etc).
|
||||
state: Current state of the transmitter
|
||||
0: RFKILL_STATE_SOFT_BLOCKED
|
||||
transmitter is turned off by software
|
||||
@@ -117,7 +119,12 @@ The following sysfs entries exist for every rfkill device:
|
||||
2: RFKILL_STATE_HARD_BLOCKED
|
||||
transmitter is forced off by something outside of
|
||||
the driver's control.
|
||||
claim: 0: Kernel handles events (currently always reads that value)
|
||||
This file is deprecated because it can only properly show
|
||||
three of the four possible states, soft-and-hard-blocked is
|
||||
missing.
|
||||
claim: 0: Kernel handles events
|
||||
This file is deprecated because there no longer is a way to
|
||||
claim just control over a single rfkill instance.
|
||||
|
||||
rfkill devices also issue uevents (with an action of "change"), with the
|
||||
following environment variables set:
|
||||
@@ -128,9 +135,3 @@ RFKILL_TYPE
|
||||
|
||||
The contents of these variables corresponds to the "name", "state" and
|
||||
"type" sysfs files explained above.
|
||||
|
||||
An alternative userspace interface exists as a misc device /dev/rfkill,
|
||||
which allows userspace to obtain and set the state of rfkill devices and
|
||||
sets of devices. It also notifies userspace about device addition and
|
||||
removal. The API is a simple read/write API that is defined in
|
||||
linux/rfkill.h.
|
||||
|
||||
@@ -1300,7 +1300,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
netif_stop_queue(ndev);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -3552,14 +3552,14 @@ bnx2_set_rx_mode(struct net_device *dev)
|
||||
sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN;
|
||||
}
|
||||
|
||||
if (dev->uc_count > BNX2_MAX_UNICAST_ADDRESSES) {
|
||||
if (dev->uc.count > BNX2_MAX_UNICAST_ADDRESSES) {
|
||||
rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS;
|
||||
sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN |
|
||||
BNX2_RPM_SORT_USER0_PROM_VLAN;
|
||||
} else if (!(dev->flags & IFF_PROMISC)) {
|
||||
/* Add all entries into to the match filter list */
|
||||
i = 0;
|
||||
list_for_each_entry(ha, &dev->uc_list, list) {
|
||||
list_for_each_entry(ha, &dev->uc.list, list) {
|
||||
bnx2_set_mac_addr(bp, ha->addr,
|
||||
i + BNX2_START_UNICAST_ADDRESS_INDEX);
|
||||
sort_mode |= (1 <<
|
||||
|
||||
@@ -2767,7 +2767,6 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
|
||||
|
||||
dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n");
|
||||
|
||||
clk_disable(emac_clk);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
mdiobus_unregister(priv->mii_bus);
|
||||
|
||||
+6
-5
@@ -2895,12 +2895,13 @@ static void __e100_shutdown(struct pci_dev *pdev, bool *enable_wake)
|
||||
|
||||
static int __e100_power_off(struct pci_dev *pdev, bool wake)
|
||||
{
|
||||
if (wake) {
|
||||
if (wake)
|
||||
return pci_prepare_to_sleep(pdev);
|
||||
} else {
|
||||
pci_wake_from_d3(pdev, false);
|
||||
return pci_set_power_state(pdev, PCI_D3hot);
|
||||
}
|
||||
|
||||
pci_wake_from_d3(pdev, false);
|
||||
pci_set_power_state(pdev, PCI_D3hot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
@@ -2370,7 +2370,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
|
||||
rctl |= E1000_RCTL_VFE;
|
||||
}
|
||||
|
||||
if (netdev->uc_count > rar_entries - 1) {
|
||||
if (netdev->uc.count > rar_entries - 1) {
|
||||
rctl |= E1000_RCTL_UPE;
|
||||
} else if (!(netdev->flags & IFF_PROMISC)) {
|
||||
rctl &= ~E1000_RCTL_UPE;
|
||||
@@ -2394,7 +2394,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
|
||||
*/
|
||||
i = 1;
|
||||
if (use_uc)
|
||||
list_for_each_entry(ha, &netdev->uc_list, list) {
|
||||
list_for_each_entry(ha, &netdev->uc.list, list) {
|
||||
if (i == rar_entries)
|
||||
break;
|
||||
e1000_rar_set(hw, ha->addr, i++);
|
||||
|
||||
+27
-19
@@ -719,7 +719,8 @@ static const struct register_test nv_registers_test[] = {
|
||||
struct nv_skb_map {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t dma;
|
||||
unsigned int dma_len;
|
||||
unsigned int dma_len:31;
|
||||
unsigned int dma_single:1;
|
||||
struct ring_desc_ex *first_tx_desc;
|
||||
struct nv_skb_map *next_tx_ctx;
|
||||
};
|
||||
@@ -1912,6 +1913,7 @@ static void nv_init_tx(struct net_device *dev)
|
||||
np->tx_skb[i].skb = NULL;
|
||||
np->tx_skb[i].dma = 0;
|
||||
np->tx_skb[i].dma_len = 0;
|
||||
np->tx_skb[i].dma_single = 0;
|
||||
np->tx_skb[i].first_tx_desc = NULL;
|
||||
np->tx_skb[i].next_tx_ctx = NULL;
|
||||
}
|
||||
@@ -1930,23 +1932,30 @@ static int nv_init_ring(struct net_device *dev)
|
||||
return nv_alloc_rx_optimized(dev);
|
||||
}
|
||||
|
||||
static int nv_release_txskb(struct net_device *dev, struct nv_skb_map* tx_skb)
|
||||
static void nv_unmap_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb)
|
||||
{
|
||||
struct fe_priv *np = netdev_priv(dev);
|
||||
|
||||
if (tx_skb->dma) {
|
||||
pci_unmap_page(np->pci_dev, tx_skb->dma,
|
||||
tx_skb->dma_len,
|
||||
PCI_DMA_TODEVICE);
|
||||
if (tx_skb->dma_single)
|
||||
pci_unmap_single(np->pci_dev, tx_skb->dma,
|
||||
tx_skb->dma_len,
|
||||
PCI_DMA_TODEVICE);
|
||||
else
|
||||
pci_unmap_page(np->pci_dev, tx_skb->dma,
|
||||
tx_skb->dma_len,
|
||||
PCI_DMA_TODEVICE);
|
||||
tx_skb->dma = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int nv_release_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb)
|
||||
{
|
||||
nv_unmap_txskb(np, tx_skb);
|
||||
if (tx_skb->skb) {
|
||||
dev_kfree_skb_any(tx_skb->skb);
|
||||
tx_skb->skb = NULL;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nv_drain_tx(struct net_device *dev)
|
||||
@@ -1964,10 +1973,11 @@ static void nv_drain_tx(struct net_device *dev)
|
||||
np->tx_ring.ex[i].bufhigh = 0;
|
||||
np->tx_ring.ex[i].buflow = 0;
|
||||
}
|
||||
if (nv_release_txskb(dev, &np->tx_skb[i]))
|
||||
if (nv_release_txskb(np, &np->tx_skb[i]))
|
||||
dev->stats.tx_dropped++;
|
||||
np->tx_skb[i].dma = 0;
|
||||
np->tx_skb[i].dma_len = 0;
|
||||
np->tx_skb[i].dma_single = 0;
|
||||
np->tx_skb[i].first_tx_desc = NULL;
|
||||
np->tx_skb[i].next_tx_ctx = NULL;
|
||||
}
|
||||
@@ -2171,6 +2181,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->put_tx_ctx->dma_len = bcnt;
|
||||
np->put_tx_ctx->dma_single = 1;
|
||||
put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
|
||||
put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
|
||||
|
||||
@@ -2196,6 +2207,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->put_tx_ctx->dma_len = bcnt;
|
||||
np->put_tx_ctx->dma_single = 0;
|
||||
put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
|
||||
put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
|
||||
|
||||
@@ -2291,6 +2303,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
|
||||
np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->put_tx_ctx->dma_len = bcnt;
|
||||
np->put_tx_ctx->dma_single = 1;
|
||||
put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
|
||||
put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma));
|
||||
put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
|
||||
@@ -2317,6 +2330,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
|
||||
np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->put_tx_ctx->dma_len = bcnt;
|
||||
np->put_tx_ctx->dma_single = 0;
|
||||
put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
|
||||
put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma));
|
||||
put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
|
||||
@@ -2434,10 +2448,7 @@ static int nv_tx_done(struct net_device *dev, int limit)
|
||||
dprintk(KERN_DEBUG "%s: nv_tx_done: flags 0x%x.\n",
|
||||
dev->name, flags);
|
||||
|
||||
pci_unmap_page(np->pci_dev, np->get_tx_ctx->dma,
|
||||
np->get_tx_ctx->dma_len,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->get_tx_ctx->dma = 0;
|
||||
nv_unmap_txskb(np, np->get_tx_ctx);
|
||||
|
||||
if (np->desc_ver == DESC_VER_1) {
|
||||
if (flags & NV_TX_LASTPACKET) {
|
||||
@@ -2502,10 +2513,7 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit)
|
||||
dprintk(KERN_DEBUG "%s: nv_tx_done_optimized: flags 0x%x.\n",
|
||||
dev->name, flags);
|
||||
|
||||
pci_unmap_page(np->pci_dev, np->get_tx_ctx->dma,
|
||||
np->get_tx_ctx->dma_len,
|
||||
PCI_DMA_TODEVICE);
|
||||
np->get_tx_ctx->dma = 0;
|
||||
nv_unmap_txskb(np, np->get_tx_ctx);
|
||||
|
||||
if (flags & NV_TX2_LASTPACKET) {
|
||||
if (!(flags & NV_TX2_ERROR))
|
||||
@@ -5091,7 +5099,7 @@ static int nv_loopback_test(struct net_device *dev)
|
||||
dprintk(KERN_DEBUG "%s: loopback - did not receive test packet\n", dev->name);
|
||||
}
|
||||
|
||||
pci_unmap_page(np->pci_dev, test_dma_addr,
|
||||
pci_unmap_single(np->pci_dev, test_dma_addr,
|
||||
(skb_end_pointer(tx_skb) - tx_skb->data),
|
||||
PCI_DMA_TODEVICE);
|
||||
dev_kfree_skb_any(tx_skb);
|
||||
|
||||
@@ -260,7 +260,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
*/
|
||||
if (!netif_running(dev)) {
|
||||
kfree_skb(skb);
|
||||
return -ENODEV;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
skb_pull(skb, 1);
|
||||
|
||||
+17
-18
@@ -1495,13 +1495,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
|
||||
hp100_outw(0x4210, TRACE);
|
||||
printk("hp100: %s: start_xmit_bm\n", dev->name);
|
||||
#endif
|
||||
|
||||
if (skb == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (skb->len <= 0)
|
||||
return 0;
|
||||
goto drop;
|
||||
|
||||
if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN))
|
||||
return 0;
|
||||
@@ -1514,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
|
||||
#endif
|
||||
/* not waited long enough since last tx? */
|
||||
if (time_before(jiffies, dev->trans_start + HZ))
|
||||
return -EAGAIN;
|
||||
goto drop;
|
||||
|
||||
if (hp100_check_lan(dev))
|
||||
return -EIO;
|
||||
goto drop;
|
||||
|
||||
if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
|
||||
/* we have a 100Mb/s adapter but it isn't connected to hub */
|
||||
@@ -1551,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
|
||||
}
|
||||
|
||||
dev->trans_start = jiffies;
|
||||
return -EAGAIN;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
|
||||
dev->trans_start = jiffies;
|
||||
|
||||
return 0;
|
||||
|
||||
drop:
|
||||
dev_kfree_skb(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1648,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
hp100_outw(0x4212, TRACE);
|
||||
printk("hp100: %s: start_xmit\n", dev->name);
|
||||
#endif
|
||||
|
||||
if (skb == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (skb->len <= 0)
|
||||
return 0;
|
||||
goto drop;
|
||||
|
||||
if (hp100_check_lan(dev))
|
||||
return -EIO;
|
||||
goto drop;
|
||||
|
||||
/* If there is not enough free memory on the card... */
|
||||
i = hp100_inl(TX_MEM_FREE) & 0x7fffffff;
|
||||
@@ -1671,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
printk("hp100: %s: trans_start timing problem\n",
|
||||
dev->name);
|
||||
#endif
|
||||
return -EAGAIN;
|
||||
goto drop;
|
||||
}
|
||||
if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
|
||||
/* we have a 100Mb/s adapter but it isn't connected to hub */
|
||||
@@ -1705,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
}
|
||||
}
|
||||
dev->trans_start = jiffies;
|
||||
return -EAGAIN;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) {
|
||||
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
drop:
|
||||
dev_kfree_skb(skb);
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2321,7 +2321,7 @@ static void ixgbe_set_rx_mode(struct net_device *netdev)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
|
||||
|
||||
/* reprogram secondary unicast list */
|
||||
hw->mac.ops.update_uc_addr_list(hw, &netdev->uc_list);
|
||||
hw->mac.ops.update_uc_addr_list(hw, &netdev->uc.list);
|
||||
|
||||
/* reprogram multicast list */
|
||||
addr_count = netdev->mc_count;
|
||||
@@ -5261,7 +5261,7 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
|
||||
|
||||
/**
|
||||
* ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding
|
||||
* netdev->dev_addr_list
|
||||
* netdev->dev_addrs
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Returns non-zero on failure
|
||||
@@ -5282,7 +5282,7 @@ static int ixgbe_add_sanmac_netdev(struct net_device *dev)
|
||||
|
||||
/**
|
||||
* ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding
|
||||
* netdev->dev_addr_list
|
||||
* netdev->dev_addrs
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Returns non-zero on failure
|
||||
|
||||
@@ -1729,7 +1729,7 @@ static u32 uc_addr_filter_mask(struct net_device *dev)
|
||||
return 0;
|
||||
|
||||
nibbles = 1 << (dev->dev_addr[5] & 0x0f);
|
||||
list_for_each_entry(ha, &dev->uc_list, list) {
|
||||
list_for_each_entry(ha, &dev->uc.list, list) {
|
||||
if (memcmp(dev->dev_addr, ha->addr, 5))
|
||||
return 0;
|
||||
if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0)
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
#define MAX_NUM_CARDS 4
|
||||
|
||||
#define MAX_BUFFERS_PER_CMD 32
|
||||
#define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + 4)
|
||||
|
||||
/*
|
||||
* Following are the states of the Phantom. Phantom will set them and
|
||||
@@ -1436,7 +1437,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p);
|
||||
struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
|
||||
|
||||
void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
|
||||
struct nx_host_tx_ring *tx_ring, uint32_t crb_producer);
|
||||
struct nx_host_tx_ring *tx_ring);
|
||||
|
||||
/*
|
||||
* NetXen Board information
|
||||
@@ -1538,6 +1539,14 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter)
|
||||
}
|
||||
|
||||
|
||||
static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring)
|
||||
{
|
||||
smp_mb();
|
||||
return find_diff_among(tx_ring->producer,
|
||||
tx_ring->sw_consumer, tx_ring->num_desc);
|
||||
|
||||
}
|
||||
|
||||
int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
|
||||
int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
|
||||
extern void netxen_change_ringparam(struct netxen_adapter *adapter);
|
||||
|
||||
@@ -355,6 +355,7 @@ enum {
|
||||
#define NETXEN_HW_CRB_HUB_AGT_ADR_LPC \
|
||||
((NETXEN_HW_H6_CH_HUB_ADR << 7) | NETXEN_HW_LPC_CRB_AGT_ADR)
|
||||
|
||||
#define NETXEN_SRE_MISC (NETXEN_CRB_SRE + 0x0002c)
|
||||
#define NETXEN_SRE_INT_STATUS (NETXEN_CRB_SRE + 0x00034)
|
||||
#define NETXEN_SRE_PBI_ACTIVE_STATUS (NETXEN_CRB_SRE + 0x01014)
|
||||
#define NETXEN_SRE_L1RE_CTL (NETXEN_CRB_SRE + 0x03000)
|
||||
|
||||
@@ -488,7 +488,7 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
|
||||
|
||||
tx_ring->producer = producer;
|
||||
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring, producer);
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring);
|
||||
|
||||
netif_tx_unlock_bh(adapter->netdev);
|
||||
|
||||
@@ -2041,8 +2041,8 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
|
||||
fw_major, fw_minor, fw_build);
|
||||
|
||||
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
|
||||
i = NXRD32(adapter, NETXEN_MIU_MN_CONTROL);
|
||||
adapter->ahw.cut_through = (i & 0x4) ? 1 : 0;
|
||||
i = NXRD32(adapter, NETXEN_SRE_MISC);
|
||||
adapter->ahw.cut_through = (i & 0x8000) ? 1 : 0;
|
||||
dev_info(&pdev->dev, "firmware running in %s mode\n",
|
||||
adapter->ahw.cut_through ? "cut-through" : "legacy");
|
||||
}
|
||||
|
||||
@@ -1292,7 +1292,6 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
|
||||
return 1;
|
||||
|
||||
sw_consumer = tx_ring->sw_consumer;
|
||||
barrier(); /* hw_consumer can change underneath */
|
||||
hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
|
||||
|
||||
while (sw_consumer != hw_consumer) {
|
||||
@@ -1319,14 +1318,15 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
|
||||
break;
|
||||
}
|
||||
|
||||
tx_ring->sw_consumer = sw_consumer;
|
||||
|
||||
if (count && netif_running(netdev)) {
|
||||
tx_ring->sw_consumer = sw_consumer;
|
||||
|
||||
smp_mb();
|
||||
|
||||
if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) {
|
||||
netif_tx_lock(netdev);
|
||||
netif_wake_queue(netdev);
|
||||
smp_mb();
|
||||
if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
|
||||
netif_wake_queue(netdev);
|
||||
netif_tx_unlock(netdev);
|
||||
}
|
||||
}
|
||||
@@ -1343,7 +1343,6 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
|
||||
* There is still a possible race condition and the host could miss an
|
||||
* interrupt. The card has to take care of this.
|
||||
*/
|
||||
barrier(); /* hw_consumer can change underneath */
|
||||
hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
|
||||
done = (sw_consumer == hw_consumer);
|
||||
spin_unlock(&adapter->tx_clean_lock);
|
||||
|
||||
@@ -107,9 +107,14 @@ static uint32_t crb_cmd_producer[4] = {
|
||||
|
||||
void
|
||||
netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
|
||||
struct nx_host_tx_ring *tx_ring, u32 producer)
|
||||
struct nx_host_tx_ring *tx_ring)
|
||||
{
|
||||
NXWR32(adapter, tx_ring->crb_cmd_producer, producer);
|
||||
NXWR32(adapter, tx_ring->crb_cmd_producer, tx_ring->producer);
|
||||
|
||||
if (netxen_tx_avail(tx_ring) <= TX_STOP_THRESH) {
|
||||
netif_stop_queue(adapter->netdev);
|
||||
smp_mb();
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t crb_cmd_consumer[4] = {
|
||||
@@ -119,9 +124,9 @@ static uint32_t crb_cmd_consumer[4] = {
|
||||
|
||||
static inline void
|
||||
netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter,
|
||||
struct nx_host_tx_ring *tx_ring, u32 consumer)
|
||||
struct nx_host_tx_ring *tx_ring)
|
||||
{
|
||||
NXWR32(adapter, tx_ring->crb_cmd_consumer, consumer);
|
||||
NXWR32(adapter, tx_ring->crb_cmd_consumer, tx_ring->sw_consumer);
|
||||
}
|
||||
|
||||
static uint32_t msi_tgt_status[8] = {
|
||||
@@ -900,8 +905,11 @@ netxen_nic_attach(struct netxen_adapter *adapter)
|
||||
tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum];
|
||||
tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum];
|
||||
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring, 0);
|
||||
netxen_nic_update_cmd_consumer(adapter, tx_ring, 0);
|
||||
tx_ring->producer = 0;
|
||||
tx_ring->sw_consumer = 0;
|
||||
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring);
|
||||
netxen_nic_update_cmd_consumer(adapter, tx_ring);
|
||||
}
|
||||
|
||||
for (ring = 0; ring < adapter->max_rds_rings; ring++) {
|
||||
@@ -1362,7 +1370,7 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
|
||||
dma_addr_t temp_dma;
|
||||
int i, k;
|
||||
|
||||
u32 producer, consumer;
|
||||
u32 producer;
|
||||
int frag_count, no_of_desc;
|
||||
u32 num_txd = tx_ring->num_desc;
|
||||
bool is_tso = false;
|
||||
@@ -1372,15 +1380,13 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
|
||||
/* 4 fragments per cmd des */
|
||||
no_of_desc = (frag_count + 3) >> 2;
|
||||
|
||||
producer = tx_ring->producer;
|
||||
smp_mb();
|
||||
consumer = tx_ring->sw_consumer;
|
||||
if ((no_of_desc+2) >= find_diff_among(producer, consumer, num_txd)) {
|
||||
if (unlikely(no_of_desc + 2) > netxen_tx_avail(tx_ring)) {
|
||||
netif_stop_queue(netdev);
|
||||
smp_mb();
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
producer = tx_ring->producer;
|
||||
|
||||
hwdesc = &tx_ring->desc_head[producer];
|
||||
netxen_clear_cmddesc((u64 *)hwdesc);
|
||||
pbuf = &tx_ring->cmd_buf_arr[producer];
|
||||
@@ -1493,7 +1499,7 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
|
||||
tx_ring->producer = producer;
|
||||
adapter->stats.txbytes += skb->len;
|
||||
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring, producer);
|
||||
netxen_nic_update_cmd_producer(adapter, tx_ring);
|
||||
|
||||
adapter->stats.xmitcalled++;
|
||||
|
||||
|
||||
+2
-2
@@ -6376,7 +6376,7 @@ static void niu_set_rx_mode(struct net_device *dev)
|
||||
if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0))
|
||||
np->flags |= NIU_FLAGS_MCAST;
|
||||
|
||||
alt_cnt = dev->uc_count;
|
||||
alt_cnt = dev->uc.count;
|
||||
if (alt_cnt > niu_num_alt_addr(np)) {
|
||||
alt_cnt = 0;
|
||||
np->flags |= NIU_FLAGS_PROMISC;
|
||||
@@ -6385,7 +6385,7 @@ static void niu_set_rx_mode(struct net_device *dev)
|
||||
if (alt_cnt) {
|
||||
int index = 0;
|
||||
|
||||
list_for_each_entry(ha, &dev->uc_list, list) {
|
||||
list_for_each_entry(ha, &dev->uc.list, list) {
|
||||
err = niu_set_alt_mac(np, index, ha->addr);
|
||||
if (err)
|
||||
printk(KERN_WARNING PFX "%s: Error %d "
|
||||
|
||||
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(get_phy_device);
|
||||
|
||||
/**
|
||||
* phy_device_register - Register the phy device on the MDIO bus
|
||||
* @phy_device: phy_device structure to be added to the MDIO bus
|
||||
* @phydev: phy_device structure to be added to the MDIO bus
|
||||
*/
|
||||
int phy_device_register(struct phy_device *phydev)
|
||||
{
|
||||
|
||||
+8
-11
@@ -3811,22 +3811,11 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev)
|
||||
|
||||
static void rtl8169_net_suspend(struct net_device *dev)
|
||||
{
|
||||
struct rtl8169_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
if (!netif_running(dev))
|
||||
return;
|
||||
|
||||
netif_device_detach(dev);
|
||||
netif_stop_queue(dev);
|
||||
|
||||
spin_lock_irq(&tp->lock);
|
||||
|
||||
rtl8169_asic_down(ioaddr);
|
||||
|
||||
rtl8169_rx_missed(dev, ioaddr);
|
||||
|
||||
spin_unlock_irq(&tp->lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@@ -3876,9 +3865,17 @@ static struct dev_pm_ops rtl8169_pm_ops = {
|
||||
static void rtl_shutdown(struct pci_dev *pdev)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata(pdev);
|
||||
struct rtl8169_private *tp = netdev_priv(dev);
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
rtl8169_net_suspend(dev);
|
||||
|
||||
spin_lock_irq(&tp->lock);
|
||||
|
||||
rtl8169_asic_down(ioaddr);
|
||||
|
||||
spin_unlock_irq(&tp->lock);
|
||||
|
||||
if (system_state == SYSTEM_POWER_OFF) {
|
||||
pci_wake_from_d3(pdev, true);
|
||||
pci_set_power_state(pdev, PCI_D3hot);
|
||||
|
||||
@@ -1281,7 +1281,7 @@ static u16 sis190_default_phy(struct net_device *dev)
|
||||
else if (phy_lan)
|
||||
phy_default = phy_lan;
|
||||
else
|
||||
phy_default = list_entry(&tp->first_phy,
|
||||
phy_default = list_first_entry(&tp->first_phy,
|
||||
struct sis190_phy, list);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user