* [PATCH] net: macvlan: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
Not much of a conversion anyway - macvlan has no way to change the offload
settings independently to its base device.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/macvlan.c | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 78e34e9..3ad5425 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -415,7 +415,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
#define MACVLAN_FEATURES \
(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
- NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO)
+ NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM)
#define MACVLAN_STATE_MASK \
((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
@@ -517,12 +517,6 @@ static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
snprintf(drvinfo->version, 32, "0.1");
}
-static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev)
-{
- const struct macvlan_dev *vlan = netdev_priv(dev);
- return dev_ethtool_get_rx_csum(vlan->lowerdev);
-}
-
static int macvlan_ethtool_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd)
{
@@ -530,18 +524,10 @@ static int macvlan_ethtool_get_settings(struct net_device *dev,
return dev_ethtool_get_settings(vlan->lowerdev, cmd);
}
-static u32 macvlan_ethtool_get_flags(struct net_device *dev)
-{
- const struct macvlan_dev *vlan = netdev_priv(dev);
- return dev_ethtool_get_flags(vlan->lowerdev);
-}
-
static const struct ethtool_ops macvlan_ethtool_ops = {
.get_link = ethtool_op_get_link,
.get_settings = macvlan_ethtool_get_settings,
- .get_rx_csum = macvlan_ethtool_get_rx_csum,
.get_drvinfo = macvlan_ethtool_get_drvinfo,
- .get_flags = macvlan_ethtool_get_flags,
};
static const struct net_device_ops macvlan_netdev_ops = {
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: tehuti: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Alexander Indenbaum, Andy Gospodarek
As a side effect, make TX offloads changeable.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/tehuti.c | 26 +++-----------------------
1 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 8564ec5..8be71de 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -2017,9 +2017,11 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ndev->irq = pdev->irq;
ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO
| NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
- NETIF_F_HW_VLAN_FILTER
+ NETIF_F_HW_VLAN_FILTER | NETIF_F_RXCSUM
/*| NETIF_F_FRAGLIST */
;
+ ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
+ NETIF_F_TSO | NETIF_F_HW_VLAN_TX;
if (pci_using_dac)
ndev->features |= NETIF_F_HIGHDMA;
@@ -2188,24 +2190,6 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
}
/*
- * bdx_get_rx_csum - report whether receive checksums are turned on or off
- * @netdev
- */
-static u32 bdx_get_rx_csum(struct net_device *netdev)
-{
- return 1; /* always on */
-}
-
-/*
- * bdx_get_tx_csum - report whether transmit checksums are turned on or off
- * @netdev
- */
-static u32 bdx_get_tx_csum(struct net_device *netdev)
-{
- return (netdev->features & NETIF_F_IP_CSUM) != 0;
-}
-
-/*
* bdx_get_coalesce - get interrupt coalescing parameters
* @netdev
* @ecoal
@@ -2424,10 +2408,6 @@ static void bdx_set_ethtool_ops(struct net_device *netdev)
.set_coalesce = bdx_set_coalesce,
.get_ringparam = bdx_get_ringparam,
.set_ringparam = bdx_set_ringparam,
- .get_rx_csum = bdx_get_rx_csum,
- .get_tx_csum = bdx_get_tx_csum,
- .get_sg = ethtool_op_get_sg,
- .get_tso = ethtool_op_get_tso,
.get_strings = bdx_get_strings,
.get_sset_count = bdx_get_sset_count,
.get_ethtool_stats = bdx_get_ethtool_stats,
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: mv643xx: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Lennert Buytenhek
Side effect: don't reenable RXCSUM on every ifdown/ifup.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/mv643xx_eth.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 34425b9..29605a3 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1575,18 +1575,12 @@ mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er)
return 0;
}
-static u32
-mv643xx_eth_get_rx_csum(struct net_device *dev)
-{
- struct mv643xx_eth_private *mp = netdev_priv(dev);
-
- return !!(rdlp(mp, PORT_CONFIG) & 0x02000000);
-}
static int
-mv643xx_eth_set_rx_csum(struct net_device *dev, u32 rx_csum)
+mv643xx_eth_set_features(struct net_device *dev, u32 features)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);
+ u32 rx_csum = features & NETIF_F_RXCSUM;
wrlp(mp, PORT_CONFIG, rx_csum ? 0x02000000 : 0x00000000);
@@ -1634,11 +1628,6 @@ static void mv643xx_eth_get_ethtool_stats(struct net_device *dev,
}
}
-static int mv643xx_eth_set_flags(struct net_device *dev, u32 data)
-{
- return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO);
-}
-
static int mv643xx_eth_get_sset_count(struct net_device *dev, int sset)
{
if (sset == ETH_SS_STATS)
@@ -1657,14 +1646,8 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
.set_coalesce = mv643xx_eth_set_coalesce,
.get_ringparam = mv643xx_eth_get_ringparam,
.set_ringparam = mv643xx_eth_set_ringparam,
- .get_rx_csum = mv643xx_eth_get_rx_csum,
- .set_rx_csum = mv643xx_eth_set_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_csum,
- .set_sg = ethtool_op_set_sg,
.get_strings = mv643xx_eth_get_strings,
.get_ethtool_stats = mv643xx_eth_get_ethtool_stats,
- .get_flags = ethtool_op_get_flags,
- .set_flags = mv643xx_eth_set_flags,
.get_sset_count = mv643xx_eth_get_sset_count,
};
@@ -2264,7 +2247,7 @@ static void port_start(struct mv643xx_eth_private *mp)
* frames to RX queue #0, and include the pseudo-header when
* calculating receive checksums.
*/
- wrlp(mp, PORT_CONFIG, 0x02000000);
+ mv643xx_eth_set_features(dev, dev->features);
/*
* Treat BPDUs as normal multicasts, and disable partition mode.
@@ -2848,6 +2831,7 @@ static const struct net_device_ops mv643xx_eth_netdev_ops = {
.ndo_validate_addr = eth_validate_addr,
.ndo_do_ioctl = mv643xx_eth_ioctl,
.ndo_change_mtu = mv643xx_eth_change_mtu,
+ .ndo_set_features = mv643xx_eth_set_features,
.ndo_tx_timeout = mv643xx_eth_tx_timeout,
.ndo_get_stats = mv643xx_eth_get_stats,
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2930,7 +2914,9 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
dev->watchdog_timeo = 2 * HZ;
dev->base_addr = 0;
- dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
+ dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_RXCSUM | NETIF_F_LRO;
+ dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM;
SET_NETDEV_DEV(dev, &pdev->dev);
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: cxgb3: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Divy Le Ray
This removes some of the remnants of LRO -> GRO conversion.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/cxgb3/adapter.h | 7 ----
drivers/net/cxgb3/common.h | 1 -
drivers/net/cxgb3/cxgb3_main.c | 78 +++++++---------------------------------
drivers/net/cxgb3/sge.c | 7 ++--
4 files changed, 17 insertions(+), 76 deletions(-)
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ef67be5..7300de5 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,11 +50,6 @@ struct adapter;
struct sge_qset;
struct port_info;
-enum { /* rx_offload flags */
- T3_RX_CSUM = 1 << 0,
- T3_LRO = 1 << 1,
-};
-
enum mac_idx_types {
LAN_MAC_IDX = 0,
SAN_MAC_IDX,
@@ -74,7 +69,6 @@ struct port_info {
struct vlan_group *vlan_grp;
struct sge_qset *qs;
u8 port_id;
- u8 rx_offload;
u8 nqsets;
u8 first_qset;
struct cphy phy;
@@ -212,7 +206,6 @@ struct sge_qset { /* an SGE queue set */
struct sge_fl fl[SGE_RXQ_PER_SET];
struct sge_txq txq[SGE_TXQ_PER_SET];
int nomem;
- int lro_enabled;
void *lro_va;
struct net_device *netdev;
struct netdev_queue *tx_q; /* associated netdev TX queue */
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 5ccb77d..056ee8c 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -317,7 +317,6 @@ struct tp_params {
struct qset_params { /* SGE queue set parameters */
unsigned int polling; /* polling/interrupt service for rspq */
- unsigned int lro; /* large receive offload */
unsigned int coalesce_usecs; /* irq coalescing timer */
unsigned int rspq_size; /* # of entries in response queue */
unsigned int fl_size; /* # of entries in regular free list */
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index a087e06..0404918 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -644,26 +644,6 @@ static void enable_all_napi(struct adapter *adap)
}
/**
- * set_qset_lro - Turn a queue set's LRO capability on and off
- * @dev: the device the qset is attached to
- * @qset_idx: the queue set index
- * @val: the LRO switch
- *
- * Sets LRO on or off for a particular queue set.
- * the device's features flag is updated to reflect the LRO
- * capability when all queues belonging to the device are
- * in the same state.
- */
-static void set_qset_lro(struct net_device *dev, int qset_idx, int val)
-{
- struct port_info *pi = netdev_priv(dev);
- struct adapter *adapter = pi->adapter;
-
- adapter->params.sge.qset[qset_idx].lro = !!val;
- adapter->sge.qs[qset_idx].lro_enabled = !!val;
-}
-
-/**
* setup_sge_qsets - configure SGE Tx/Rx/response queues
* @adap: the adapter
*
@@ -685,7 +665,6 @@ static int setup_sge_qsets(struct adapter *adap)
pi->qs = &adap->sge.qs[pi->first_qset];
for (j = 0; j < pi->nqsets; ++j, ++qset_idx) {
- set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO);
err = t3_sge_alloc_qset(adap, qset_idx, 1,
(adap->flags & USING_MSIX) ? qset_idx + 1 :
irq_idx,
@@ -1910,29 +1889,6 @@ static int set_pauseparam(struct net_device *dev,
return 0;
}
-static u32 get_rx_csum(struct net_device *dev)
-{
- struct port_info *p = netdev_priv(dev);
-
- return p->rx_offload & T3_RX_CSUM;
-}
-
-static int set_rx_csum(struct net_device *dev, u32 data)
-{
- struct port_info *p = netdev_priv(dev);
-
- if (data) {
- p->rx_offload |= T3_RX_CSUM;
- } else {
- int i;
-
- p->rx_offload &= ~(T3_RX_CSUM | T3_LRO);
- for (i = p->first_qset; i < p->first_qset + p->nqsets; i++)
- set_qset_lro(dev, i, 0);
- }
- return 0;
-}
-
static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
{
struct port_info *pi = netdev_priv(dev);
@@ -2104,10 +2060,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
.set_eeprom = set_eeprom,
.get_pauseparam = get_pauseparam,
.set_pauseparam = set_pauseparam,
- .get_rx_csum = get_rx_csum,
- .set_rx_csum = set_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_csum,
- .set_sg = ethtool_op_set_sg,
.get_link = ethtool_op_get_link,
.get_strings = get_strings,
.set_phys_id = set_phys_id,
@@ -2117,7 +2069,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
.get_regs_len = get_regs_len,
.get_regs = get_regs,
.get_wol = get_wol,
- .set_tso = ethtool_op_set_tso,
};
static int in_range(int val, int lo, int hi)
@@ -2165,15 +2116,6 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
MAX_RSPQ_ENTRIES))
return -EINVAL;
- if ((adapter->flags & FULL_INIT_DONE) && t.lro > 0)
- for_each_port(adapter, i) {
- pi = adap2pinfo(adapter, i);
- if (t.qset_idx >= pi->first_qset &&
- t.qset_idx < pi->first_qset + pi->nqsets &&
- !(pi->rx_offload & T3_RX_CSUM))
- return -EINVAL;
- }
-
if ((adapter->flags & FULL_INIT_DONE) &&
(t.rspq_size >= 0 || t.fl_size[0] >= 0 ||
t.fl_size[1] >= 0 || t.txq_size[0] >= 0 ||
@@ -2234,8 +2176,14 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
}
}
}
- if (t.lro >= 0)
- set_qset_lro(dev, t.qset_idx, t.lro);
+
+ if (t.lro >= 0) {
+ if (t.lro)
+ dev->wanted_features |= NETIF_F_GRO;
+ else
+ dev->wanted_features &= ~NETIF_F_GRO;
+ netdev_update_features(dev);
+ }
break;
}
@@ -2269,7 +2217,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
t.fl_size[0] = q->fl_size;
t.fl_size[1] = q->jumbo_size;
t.polling = q->polling;
- t.lro = q->lro;
+ t.lro = !!(dev->features & NETIF_F_GRO);
t.intr_lat = q->coalesce_usecs;
t.cong_thres = q->cong_thres;
t.qnum = q1;
@@ -3307,18 +3255,18 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter->port[i] = netdev;
pi = netdev_priv(netdev);
pi->adapter = adapter;
- pi->rx_offload = T3_RX_CSUM | T3_LRO;
pi->port_id = i;
netif_carrier_off(netdev);
netdev->irq = pdev->irq;
netdev->mem_start = mmio_start;
netdev->mem_end = mmio_start + mmio_len - 1;
- netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
- netdev->features |= NETIF_F_GRO;
+ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_TSO | NETIF_F_RXCSUM;
+ netdev->features |= netdev->hw_features |
+ NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
- netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
netdev->netdev_ops = &cxgb_netdev_ops;
SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops);
}
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index bfa2d56..cba1401 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2019,7 +2019,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
skb_pull(skb, sizeof(*p) + pad);
skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
pi = netdev_priv(skb->dev);
- if ((pi->rx_offload & T3_RX_CSUM) && p->csum_valid &&
+ if ((skb->dev->features & NETIF_F_RXCSUM) && p->csum_valid &&
p->csum == htons(0xffff) && !p->fragment) {
qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -2120,7 +2120,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
offset = 2 + sizeof(struct cpl_rx_pkt);
cpl = qs->lro_va = sd->pg_chunk.va + 2;
- if ((pi->rx_offload & T3_RX_CSUM) &&
+ if ((qs->netdev->features & NETIF_F_RXCSUM) &&
cpl->csum_valid && cpl->csum == htons(0xffff)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
@@ -2285,7 +2285,8 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
q->next_holdoff = q->holdoff_tmr;
while (likely(budget_left && is_new_response(r, q))) {
- int packet_complete, eth, ethpad = 2, lro = qs->lro_enabled;
+ int packet_complete, eth, ethpad = 2;
+ int lro = !!(qs->netdev->features & NETIF_F_GRO);
struct sk_buff *skb = NULL;
u32 len, flags;
__be32 rss_hi, rss_lo;
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: chelsio: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev
Also remove flags that were not used or are now redundant to hw_features bits.
No device had UDP_CSUM_CAPABLE set.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/chelsio/common.h | 5 ----
drivers/net/chelsio/cxgb2.c | 48 ++++++-----------------------------------
drivers/net/chelsio/sge.c | 12 +++++-----
drivers/net/chelsio/tp.c | 5 ----
drivers/net/chelsio/tp.h | 1 -
5 files changed, 13 insertions(+), 58 deletions(-)
diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h
index 092f31a..c26d863 100644
--- a/drivers/net/chelsio/common.h
+++ b/drivers/net/chelsio/common.h
@@ -264,11 +264,6 @@ struct adapter {
enum { /* adapter flags */
FULL_INIT_DONE = 1 << 0,
- TSO_CAPABLE = 1 << 2,
- TCP_CSUM_CAPABLE = 1 << 3,
- UDP_CSUM_CAPABLE = 1 << 4,
- VLAN_ACCEL_CAPABLE = 1 << 5,
- RX_CSUM_ENABLED = 1 << 6,
};
struct mdio_ops;
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 0f71304..5f82c9c 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -192,10 +192,8 @@ static void link_start(struct port_info *p)
static void enable_hw_csum(struct adapter *adapter)
{
- if (adapter->flags & TSO_CAPABLE)
+ if (adapter->port[0].dev->hw_features & NETIF_F_TSO)
t1_tp_set_ip_checksum_offload(adapter->tp, 1); /* for TSO only */
- if (adapter->flags & UDP_CSUM_CAPABLE)
- t1_tp_set_udp_checksum_offload(adapter->tp, 1);
t1_tp_set_tcp_checksum_offload(adapter->tp, 1);
}
@@ -705,33 +703,6 @@ static int set_pauseparam(struct net_device *dev,
return 0;
}
-static u32 get_rx_csum(struct net_device *dev)
-{
- struct adapter *adapter = dev->ml_priv;
-
- return (adapter->flags & RX_CSUM_ENABLED) != 0;
-}
-
-static int set_rx_csum(struct net_device *dev, u32 data)
-{
- struct adapter *adapter = dev->ml_priv;
-
- if (data)
- adapter->flags |= RX_CSUM_ENABLED;
- else
- adapter->flags &= ~RX_CSUM_ENABLED;
- return 0;
-}
-
-static int set_tso(struct net_device *dev, u32 value)
-{
- struct adapter *adapter = dev->ml_priv;
-
- if (!(adapter->flags & TSO_CAPABLE))
- return value ? -EOPNOTSUPP : 0;
- return ethtool_op_set_tso(dev, value);
-}
-
static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
{
struct adapter *adapter = dev->ml_priv;
@@ -831,17 +802,12 @@ static const struct ethtool_ops t1_ethtool_ops = {
.get_eeprom = get_eeprom,
.get_pauseparam = get_pauseparam,
.set_pauseparam = set_pauseparam,
- .get_rx_csum = get_rx_csum,
- .set_rx_csum = set_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_csum,
- .set_sg = ethtool_op_set_sg,
.get_link = ethtool_op_get_link,
.get_strings = get_strings,
.get_sset_count = get_sset_count,
.get_ethtool_stats = get_stats,
.get_regs_len = get_regs_len,
.get_regs = get_regs,
- .set_tso = set_tso,
};
static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
@@ -1105,28 +1071,28 @@ static int __devinit init_one(struct pci_dev *pdev,
netdev->mem_start = mmio_start;
netdev->mem_end = mmio_start + mmio_len - 1;
netdev->ml_priv = adapter;
- netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
- netdev->features |= NETIF_F_LLTX;
+ netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_RXCSUM;
+ netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_RXCSUM | NETIF_F_LLTX;
- adapter->flags |= RX_CSUM_ENABLED | TCP_CSUM_CAPABLE;
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
if (vlan_tso_capable(adapter)) {
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
- adapter->flags |= VLAN_ACCEL_CAPABLE;
netdev->features |=
NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
#endif
/* T204: disable TSO */
if (!(is_T2(adapter)) || bi->port_number != 4) {
- adapter->flags |= TSO_CAPABLE;
+ netdev->hw_features |= NETIF_F_TSO;
netdev->features |= NETIF_F_TSO;
}
}
netdev->netdev_ops = &cxgb_netdev_ops;
- netdev->hard_header_len += (adapter->flags & TSO_CAPABLE) ?
+ netdev->hard_header_len += (netdev->hw_features & NETIF_F_TSO) ?
sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt);
netif_napi_add(netdev, &adapter->napi, t1_poll, 64);
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 8754d44..f225528 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -929,7 +929,7 @@ void t1_sge_intr_enable(struct sge *sge)
u32 en = SGE_INT_ENABLE;
u32 val = readl(sge->adapter->regs + A_PL_ENABLE);
- if (sge->adapter->flags & TSO_CAPABLE)
+ if (sge->adapter->port[0].dev->hw_features & NETIF_F_TSO)
en &= ~F_PACKET_TOO_BIG;
writel(en, sge->adapter->regs + A_SG_INT_ENABLE);
writel(val | SGE_PL_INTR_MASK, sge->adapter->regs + A_PL_ENABLE);
@@ -952,7 +952,7 @@ int t1_sge_intr_error_handler(struct sge *sge)
struct adapter *adapter = sge->adapter;
u32 cause = readl(adapter->regs + A_SG_INT_CAUSE);
- if (adapter->flags & TSO_CAPABLE)
+ if (adapter->port[0].dev->hw_features & NETIF_F_TSO)
cause &= ~F_PACKET_TOO_BIG;
if (cause & F_RESPQ_EXHAUSTED)
sge->stats.respQ_empty++;
@@ -1369,6 +1369,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
const struct cpl_rx_pkt *p;
struct adapter *adapter = sge->adapter;
struct sge_port_stats *st;
+ struct net_device *dev = adapter->port[p->iff].dev;
skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad);
if (unlikely(!skb)) {
@@ -1385,8 +1386,8 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
st = this_cpu_ptr(sge->port_stats[p->iff]);
- skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
- if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff &&
+ skb->protocol = eth_type_trans(skb, dev);
+ if ((dev->features & NETIF_F_RXCSUM) && p->csum == 0xffff &&
skb->protocol == htons(ETH_P_IP) &&
(skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) {
++st->rx_cso_good;
@@ -1838,8 +1839,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
- if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
- skb->ip_summed == CHECKSUM_PARTIAL &&
+ if (skb->ip_summed == CHECKSUM_PARTIAL &&
ip_hdr(skb)->protocol == IPPROTO_UDP) {
if (unlikely(skb_checksum_help(skb))) {
pr_debug("%s: unable to do udp checksum\n", dev->name);
diff --git a/drivers/net/chelsio/tp.c b/drivers/net/chelsio/tp.c
index 6222d58..8bed4a5 100644
--- a/drivers/net/chelsio/tp.c
+++ b/drivers/net/chelsio/tp.c
@@ -152,11 +152,6 @@ void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable)
set_csum_offload(tp, F_IP_CSUM, enable);
}
-void t1_tp_set_udp_checksum_offload(struct petp *tp, int enable)
-{
- set_csum_offload(tp, F_UDP_CSUM, enable);
-}
-
void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable)
{
set_csum_offload(tp, F_TCP_CSUM, enable);
diff --git a/drivers/net/chelsio/tp.h b/drivers/net/chelsio/tp.h
index 32fc71e..dfd8ce2 100644
--- a/drivers/net/chelsio/tp.h
+++ b/drivers/net/chelsio/tp.h
@@ -65,7 +65,6 @@ void t1_tp_intr_clear(struct petp *tp);
int t1_tp_intr_handler(struct petp *tp);
void t1_tp_get_mib_statistics(adapter_t *adap, struct tp_mib_statistics *tps);
-void t1_tp_set_udp_checksum_offload(struct petp *tp, int enable);
void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable);
void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable);
int t1_tp_set_coalescing_size(struct petp *tp, unsigned int size);
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: ehea: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Breno Leitao
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/ehea/ehea_ethtool.c | 23 -----------------------
drivers/net/ehea/ehea_main.c | 4 +++-
2 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 3e2e734..5f13491 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -162,11 +162,6 @@ static void ehea_set_msglevel(struct net_device *dev, u32 value)
port->msg_enable = value;
}
-static u32 ehea_get_rx_csum(struct net_device *dev)
-{
- return 1;
-}
-
static char ehea_ethtool_stats_keys[][ETH_GSTRING_LEN] = {
{"sig_comp_iv"},
{"swqe_refill_th"},
@@ -263,34 +258,16 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
}
-static int ehea_set_flags(struct net_device *dev, u32 data)
-{
- /* Avoid changing the VLAN flags */
- if ((data & (ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN)) !=
- (ethtool_op_get_flags(dev) & (ETH_FLAG_RXVLAN |
- ETH_FLAG_TXVLAN))){
- return -EINVAL;
- }
-
- return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO
- | ETH_FLAG_TXVLAN
- | ETH_FLAG_RXVLAN);
-}
-
const struct ethtool_ops ehea_ethtool_ops = {
.get_settings = ehea_get_settings,
.get_drvinfo = ehea_get_drvinfo,
.get_msglevel = ehea_get_msglevel,
.set_msglevel = ehea_set_msglevel,
.get_link = ethtool_op_get_link,
- .set_tso = ethtool_op_set_tso,
.get_strings = ehea_get_strings,
.get_sset_count = ehea_get_sset_count,
.get_ethtool_stats = ehea_get_ethtool_stats,
- .get_rx_csum = ehea_get_rx_csum,
.set_settings = ehea_set_settings,
- .get_flags = ethtool_op_get_flags,
- .set_flags = ehea_set_flags,
.nway_reset = ehea_nway_reset, /* Restart autonegotiation */
};
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f75d314..ce2f0ca 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -3262,10 +3262,12 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
dev->netdev_ops = &ehea_netdev_ops;
ehea_set_ethtool_ops(dev);
+ dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
+ | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_LRO;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
| NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
| NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
- | NETIF_F_LLTX;
+ | NETIF_F_LLTX | NETIF_F_RXCSUM;
dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
if (use_lro)
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: benet: convert to hw_features - fixup
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla, Subbu Seetharaman, Ajit Khaparde
Remove be_set_flags() as it's already covered by hw_features.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/benet/be_ethtool.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 80226e4..ab7ebdd 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -716,18 +716,6 @@ be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
return status;
}
-static int be_set_flags(struct net_device *netdev, u32 data)
-{
- struct be_adapter *adapter = netdev_priv(netdev);
- int rc = -1;
-
- if (be_multi_rxq(adapter))
- rc = ethtool_op_set_flags(netdev, data, ETH_FLAG_RXHASH |
- ETH_FLAG_TXVLAN | ETH_FLAG_RXVLAN);
-
- return rc;
-}
-
const struct ethtool_ops be_ethtool_ops = {
.get_settings = be_get_settings,
.get_drvinfo = be_get_drvinfo,
@@ -749,5 +737,4 @@ const struct ethtool_ops be_ethtool_ops = {
.get_regs = be_get_regs,
.flash_device = be_do_flash,
.self_test = be_self_test,
- .set_flags = be_set_flags,
};
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: niu: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev
Side effect: allow toggling of TX offloads.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/niu.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index ea2272f..a707217 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7913,11 +7913,6 @@ static int niu_set_phys_id(struct net_device *dev,
return 0;
}
-static int niu_set_flags(struct net_device *dev, u32 data)
-{
- return ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH);
-}
-
static const struct ethtool_ops niu_ethtool_ops = {
.get_drvinfo = niu_get_drvinfo,
.get_link = ethtool_op_get_link,
@@ -7934,8 +7929,6 @@ static const struct ethtool_ops niu_ethtool_ops = {
.set_phys_id = niu_set_phys_id,
.get_rxnfc = niu_get_nfc,
.set_rxnfc = niu_set_nfc,
- .set_flags = niu_set_flags,
- .get_flags = ethtool_op_get_flags,
};
static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
@@ -9764,8 +9757,8 @@ static void __devinit niu_device_announce(struct niu *np)
static void __devinit niu_set_basic_features(struct net_device *dev)
{
- dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM |
- NETIF_F_GRO | NETIF_F_RXHASH);
+ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXHASH;
+ dev->features |= dev->hw_features | NETIF_F_RXCSUM;
}
static int __devinit niu_pci_init_one(struct pci_dev *pdev,
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: typhoon: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: David Dillow
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/typhoon.c | 39 ++++++++-------------------------------
1 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 82653cb..119c394 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1144,28 +1144,6 @@ typhoon_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return 0;
}
-static u32
-typhoon_get_rx_csum(struct net_device *dev)
-{
- /* For now, we don't allow turning off RX checksums.
- */
- return 1;
-}
-
-static int
-typhoon_set_flags(struct net_device *dev, u32 data)
-{
- /* There's no way to turn off the RX VLAN offloading and stripping
- * on the current 3XP firmware -- it does not respect the offload
- * settings -- so we only allow the user to toggle the TX processing.
- */
- if (!(data & ETH_FLAG_RXVLAN))
- return -EINVAL;
-
- return ethtool_op_set_flags(dev, data,
- ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
-}
-
static void
typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
{
@@ -1187,13 +1165,7 @@ static const struct ethtool_ops typhoon_ethtool_ops = {
.get_wol = typhoon_get_wol,
.set_wol = typhoon_set_wol,
.get_link = ethtool_op_get_link,
- .get_rx_csum = typhoon_get_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_csum,
- .set_sg = ethtool_op_set_sg,
- .set_tso = ethtool_op_set_tso,
.get_ringparam = typhoon_get_ringparam,
- .set_flags = typhoon_set_flags,
- .get_flags = ethtool_op_get_flags,
};
static int
@@ -2482,10 +2454,15 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* We can handle scatter gather, up to 16 entries, and
* we can do IP checksumming (only version 4, doh...)
+ *
+ * There's no way to turn off the RX VLAN offloading and stripping
+ * on the current 3XP firmware -- it does not respect the offload
+ * settings -- so we only allow the user to toggle the TX processing.
*/
- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
- dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- dev->features |= NETIF_F_TSO;
+ dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
+ NETIF_F_HW_VLAN_TX;
+ dev->features = dev->hw_features |
+ NETIF_F_HW_VLAN_RX | NETIF_F_RXCSUM;
if(register_netdev(dev) < 0) {
err_msg = "unable to register netdev";
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: greth: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev; +Cc: Kristoffer Glembo
Note: Driver modifies its struct net_device_ops. This will break if used for
multiple devices that are not all the same (if that HW config is possible).
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/greth.c | 46 ++++------------------------------------------
drivers/net/greth.h | 4 ----
2 files changed, 4 insertions(+), 46 deletions(-)
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 396ff7d..f181304 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -901,7 +901,7 @@ static int greth_rx_gbit(struct net_device *dev, int limit)
skb_put(skb, pkt_len);
- if (greth->flags & GRETH_FLAG_RX_CSUM && hw_checksummed(status))
+ if (dev->features & NETIF_F_RXCSUM && hw_checksummed(status))
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);
@@ -1142,41 +1142,6 @@ static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, vo
buff[i] = greth_read_bd(&greth_regs[i]);
}
-static u32 greth_get_rx_csum(struct net_device *dev)
-{
- struct greth_private *greth = netdev_priv(dev);
- return (greth->flags & GRETH_FLAG_RX_CSUM) != 0;
-}
-
-static int greth_set_rx_csum(struct net_device *dev, u32 data)
-{
- struct greth_private *greth = netdev_priv(dev);
-
- spin_lock_bh(&greth->devlock);
-
- if (data)
- greth->flags |= GRETH_FLAG_RX_CSUM;
- else
- greth->flags &= ~GRETH_FLAG_RX_CSUM;
-
- spin_unlock_bh(&greth->devlock);
-
- return 0;
-}
-
-static u32 greth_get_tx_csum(struct net_device *dev)
-{
- return (dev->features & NETIF_F_IP_CSUM) != 0;
-}
-
-static int greth_set_tx_csum(struct net_device *dev, u32 data)
-{
- netif_tx_lock_bh(dev);
- ethtool_op_set_tx_csum(dev, data);
- netif_tx_unlock_bh(dev);
- return 0;
-}
-
static const struct ethtool_ops greth_ethtool_ops = {
.get_msglevel = greth_get_msglevel,
.set_msglevel = greth_set_msglevel,
@@ -1185,10 +1150,6 @@ static const struct ethtool_ops greth_ethtool_ops = {
.get_drvinfo = greth_get_drvinfo,
.get_regs_len = greth_get_regs_len,
.get_regs = greth_get_regs,
- .get_rx_csum = greth_get_rx_csum,
- .set_rx_csum = greth_set_rx_csum,
- .get_tx_csum = greth_get_tx_csum,
- .set_tx_csum = greth_set_tx_csum,
.get_link = ethtool_op_get_link,
};
@@ -1570,9 +1531,10 @@ static int __devinit greth_of_probe(struct platform_device *ofdev)
GRETH_REGSAVE(regs->status, 0xFF);
if (greth->gbit_mac) {
- dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_HIGHDMA;
+ dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_RXCSUM;
+ dev->features = dev->hw_features | NETIF_F_HIGHDMA;
greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit;
- greth->flags = GRETH_FLAG_RX_CSUM;
}
if (greth->multicast) {
diff --git a/drivers/net/greth.h b/drivers/net/greth.h
index be0f206..9a0040d 100644
--- a/drivers/net/greth.h
+++ b/drivers/net/greth.h
@@ -77,9 +77,6 @@
*/
#define MAX_FRAME_SIZE 1520
-/* Flags */
-#define GRETH_FLAG_RX_CSUM 0x1
-
/* GRETH APB registers */
struct greth_regs {
u32 control;
@@ -133,7 +130,6 @@ struct greth_private {
unsigned int duplex;
u32 msg_enable;
- u32 flags;
u8 phyaddr;
u8 multicast;
--
1.7.2.5
^ permalink raw reply related
* [PATCH] net: ibm_newemac: convert to hw_features
From: Michał Mirosław @ 2011-04-17 10:15 UTC (permalink / raw)
To: netdev
Side effect: allow toggling of TX offloads.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/net/ibm_newemac/core.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 3bb990b..079450f 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2053,13 +2053,6 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev,
mutex_unlock(&dev->link_lock);
}
-static u32 emac_ethtool_get_rx_csum(struct net_device *ndev)
-{
- struct emac_instance *dev = netdev_priv(ndev);
-
- return dev->tah_dev != NULL;
-}
-
static int emac_get_regs_len(struct emac_instance *dev)
{
if (emac_has_feature(dev, EMAC_FTR_EMAC4))
@@ -2203,15 +2196,11 @@ static const struct ethtool_ops emac_ethtool_ops = {
.get_ringparam = emac_ethtool_get_ringparam,
.get_pauseparam = emac_ethtool_get_pauseparam,
- .get_rx_csum = emac_ethtool_get_rx_csum,
-
.get_strings = emac_ethtool_get_strings,
.get_sset_count = emac_ethtool_get_sset_count,
.get_ethtool_stats = emac_ethtool_get_ethtool_stats,
.get_link = ethtool_op_get_link,
- .get_tx_csum = ethtool_op_get_tx_csum,
- .get_sg = ethtool_op_get_sg,
};
static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
@@ -2859,8 +2848,10 @@ static int __devinit emac_probe(struct platform_device *ofdev)
if (err != 0)
goto err_detach_tah;
- if (dev->tah_dev)
- ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
+ if (dev->tah_dev) {
+ ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG;
+ ndev->features |= ndev->hw_features | NETIF_F_RXCSUM;
+ }
ndev->watchdog_timeo = 5 * HZ;
if (emac_phy_supports_gige(dev->phy_mode)) {
ndev->netdev_ops = &emac_gige_netdev_ops;
--
1.7.2.5
^ permalink raw reply related
* Re: Suspend/resume - slow resume
From: Francois Romieu @ 2011-04-17 10:17 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ciprian Docan, netdev, Linux Kernel Mailing List, Len Brown,
Pavel Machek, Rafael, J. Wysocki
In-Reply-To: <BANLkTi=Gq5thZk2f1nWTz3dDA5Non8ANZg@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> :
[...]
> So Francois, can we please not load the firmware at resume time when
> it wasn't loaded when suspended!
One can try the patch below. It is completely untested yet.
Subject: [PATCH] r8169: don't request firmware when there's no userspace.
The firmware is cached during open() and released during close().
The driver uses the cached firmware between open() and close().
Don't bother with rtl8169_pcierr_interrupt. It is special anyway.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/r8169.c | 76 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 52 insertions(+), 24 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 493b0de..ccc25cd 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -170,6 +170,16 @@ static const struct {
};
#undef _R
+static const struct rtl_firmware_info {
+ int mac_version;
+ const char *fw_name;
+} rtl_firmware_infos[] = {
+ { .mac_version = RTL_GIGA_MAC_VER_25, .fw_name = FIRMWARE_8168D_1 },
+ { .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 },
+ { .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 },
+ { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 }
+};
+
enum cfg_version {
RTL_CFG_0 = 0x00,
RTL_CFG_1,
@@ -1793,21 +1803,21 @@ static void rtl_release_firmware(struct rtl8169_private *tp)
tp->fw = NULL;
}
-static int rtl_apply_firmware(struct rtl8169_private *tp, const char *fw_name)
+static void rtl_apply_firmware(struct rtl8169_private *tp)
{
- const struct firmware **fw = &tp->fw;
- int rc = !*fw;
-
- if (rc) {
- rc = request_firmware(fw, fw_name, &tp->pci_dev->dev);
- if (rc < 0)
- goto out;
- }
+ const struct firmware *fw = tp->fw;
/* TODO: release firmware once rtl_phy_write_fw signals failures. */
- rtl_phy_write_fw(tp, *fw);
-out:
- return rc;
+ if (fw)
+ rtl_phy_write_fw(tp, fw);
+}
+
+static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
+{
+ if (rtl_readphy(tp, reg) != val)
+ netif_warn(tp, hw, tp->dev, "chipset not ready for firmware\n");
+ else
+ rtl_apply_firmware(tp);
}
static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
@@ -2246,10 +2256,8 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x1f, 0x0005);
rtl_writephy(tp, 0x05, 0x001b);
- if ((rtl_readphy(tp, 0x06) != 0xbf00) ||
- (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) {
- netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
- }
+
+ rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xbf00);
rtl_writephy(tp, 0x1f, 0x0000);
}
@@ -2351,10 +2359,8 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x1f, 0x0005);
rtl_writephy(tp, 0x05, 0x001b);
- if ((rtl_readphy(tp, 0x06) != 0xb300) ||
- (rtl_apply_firmware(tp, FIRMWARE_8168D_2) < 0)) {
- netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
- }
+
+ rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xb300);
rtl_writephy(tp, 0x1f, 0x0000);
}
@@ -2474,8 +2480,7 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x18, 0x0310);
msleep(100);
- if (rtl_apply_firmware(tp, FIRMWARE_8105E_1) < 0)
- netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
+ rtl_apply_firmware(tp);
rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
}
@@ -3288,8 +3293,6 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
cancel_delayed_work_sync(&tp->task);
- rtl_release_firmware(tp);
-
unregister_netdev(dev);
if (pci_dev_run_wake(pdev))
@@ -3303,6 +3306,27 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
}
+static void rtl_request_firmware(struct rtl8169_private *tp)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) {
+ const struct rtl_firmware_info *info = rtl_firmware_infos + i;
+
+ if (info->mac_version == tp->mac_version) {
+ const char *name = info->fw_name;
+ int rc;
+
+ rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev);
+ if (rc < 0) {
+ netif_warn(tp, ifup, tp->dev, "unable to load "
+ "firmware patch %s (%d)\n", name, rc);
+ }
+ break;
+ }
+ }
+}
+
static int rtl8169_open(struct net_device *dev)
{
struct rtl8169_private *tp = netdev_priv(dev);
@@ -3334,6 +3358,8 @@ static int rtl8169_open(struct net_device *dev)
smp_mb();
+ rtl_request_firmware(tp);
+
retval = request_irq(dev->irq, rtl8169_interrupt,
(tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED,
dev->name, dev);
@@ -4891,6 +4917,8 @@ static int rtl8169_close(struct net_device *dev)
free_irq(dev->irq, dev);
+ rtl_release_firmware(tp);
+
dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
tp->RxPhyAddr);
dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
--
1.7.4
^ permalink raw reply related
* my photo l
From: jessica @ 2011-04-16 17:19 UTC (permalink / raw)
i wannted to send u my photo long ago, but i was afraid that u dont like to see me . check on the links u see my photo, i hope u like it
Download that and see my photo...
http://www.speedyshare.com/files/27992773/DSC01886863.zip
or
http://www.sendspace.com/file/0venq4
or
http://www.mediafire.com/?8xlaoph1xhtark8
or
http://www.filefactory.com/file/cbce364/n/DSC01886863_zip
or
http://turboupload.com/716x682ps23o
or
http://www.mlfat4arab.com/sxwvrzwfyexj/DSC01886863.zip.html
^ permalink raw reply
* Apply For Loan At 3%
From: Willows Finance Company @ 2011-04-17 12:12 UTC (permalink / raw)
Dear Sir/Madam,
Welcome to Willows Finance Company Limited. We Offer Private, Commercial and
Personal Loans with very Minimal annual Interest Rates as Low as 3% within a
1 year to 10years repayment duration period to any part of the world. We give
out loans within the range of $5,000 to $5,000,000.00 USD. Our loans are well
insured for maximum security is our priority.
Interested Persons should contact us via E-mail:
Lender's Name: Mr. Terry Griffen
Lender's Email: terrygfinn213@w.cn
BORROWERS INFORMATION
Names:
Country:
Address:
Age:
Fax Number:
Personal Number:
Occupation:
Sex:
Monthly Income:
Amount Needed:
Loan duration:
Best Regards
Mr. Terry Griffen
CEO/Willows Finance Company.
Tel: + 44 702 404 7963
^ permalink raw reply
* 2.6.39-rc3-git7: Reported regressions from 2.6.38
From: Rafael J. Wysocki @ 2011-04-17 12:52 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Maciej Rutecki, Florian Mickler, Andrew Morton, Linus Torvalds,
Kernel Testers List, Network Development, Linux ACPI,
Linux PM List, Linux SCSI List, Linux Wireless List, DRI
This message contains a list of some regressions from 2.6.38,
for which there are no fixes in the mainline known to the tracking team.
If any of them have been fixed already, please let us know.
If you know of any other unresolved regressions from 2.6.38, please let us
know either and we'll add them to the list. Also, please let us know
if any of the entries below are invalid.
Each entry from the list will be sent additionally in an automatic reply
to this message with CCs to the people involved in reporting and handling
the issue.
Listed regressions statistics:
Date Total Pending Unresolved
----------------------------------------
2011-04-17 17 11 10
Unresolved regressions
----------------------
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33342
Subject : [2.6.39-rc2][bisected] Constant DISK_MEDIA_CHANGE_EVENTS from CDROM drive.
Submitter : Shaun Ruffell <sruffell@digium.com>
Date : 2011-04-08 20:15 (10 days old)
Message-ID : <20110408201513.GA3040@digium.com>
References : http://marc.info/?l=linux-kernel&m=130229371907209&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33272
Subject : drm related hard-hang
Submitter : Peter Teoh <htmldeveloper@gmail.com>
Date : 2011-04-14 01:29 (4 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33242
Subject : Lockdep splat in autofs with 2.6.39-rc2
Submitter : Nick Bowler <nbowler@elliptictech.com>
Date : 2011-04-07 19:44 (11 days old)
Message-ID : <20110407194403.GA29404@elliptictech.com>
References : http://marc.info/?l=linux-kernel&m=130220545614682&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33142
Subject : 2.6.39-rc2 regression: X201s fails to resume b77dcf8460ae57d4eb9fd3633eb4f97b8fb20716
Submitter : Keith Packard <keithp@keithp.com>
Date : 2011-04-06 7:44 (12 days old)
Message-ID : <yun1v1fj024.fsf@aiko.keithp.com>
References : http://marc.info/?l=linux-kernel&m=130207593728273&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33102
Subject : File's copied from client->linux server only copy 1st 64K data;rest is lost
Submitter : Linda Walsh <lkml@tlinx.org>
Date : 2011-04-11 22:12 (7 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33092
Subject : [regression] 2.6.39-rc1 - Beagleboard usbnet broken
Submitter : Mark Jackson <mpfj-list@mimc.co.uk>
Date : 2011-04-04 9:22 (14 days old)
First-Bad-Commit: http://git.kernel.org/linus/087809fce28f50098d9c3ef1a6865c722f23afd2
Message-ID : <4D998DC9.3040109@mimc.co.uk>
References : http://marc.info/?l=linux-kernel&m=130191386508831&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32982
Subject : Kernel locks up a few minutes after boot
Submitter : Bart Van Assche <bart.vanassche@gmail.com>
Date : 2011-04-10 19:55 (8 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32902
Subject : 2.6.39-rc1 doesn't boot on thinkpad t61p x86_64
Submitter : Alex Romosan <romosan@sycorax.lbl.gov>
Date : 2011-04-03 19:41 (15 days old)
Message-ID : <87k4fbnmw8.fsf@sycorax.lbl.gov>
References : http://marc.info/?l=linux-kernel&m=130186054431678&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32892
Subject : 2.6.39-rc1 data corruption with rtorrent
Submitter : Jindrich Makovicka <makovick@gmail.com>
Date : 2011-04-02 20:21 (16 days old)
Message-ID : <20110402222118.3b5c2fa8@holly>
References : http://marc.info/?l=linux-kernel&m=130177570309226&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32262
Subject : 2.6.38-git15+ IDE hangs boot
Submitter : Pete Clements <clem@clem.clem-digital.net>
Date : 2011-03-25 15:38 (24 days old)
Message-ID : <201103251538.p2PFc11i001674@clem.clem-digital.net>
References : http://marc.info/?l=linux-kernel&m=130106749313695&w=2
Regressions with patches
------------------------
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=33252
Subject : [regression 2.6.39-rc2][bisected] "perf, x86: P4 PMU - Read proper MSR register to catch" and NMIs
Submitter : Shaun Ruffell <sruffell@digium.com>
Date : 2011-04-06 22:30 (12 days old)
First-Bad-Commit: http://git.kernel.org/linus/242214f9c1eeaae40eca11e3b4d37bfce960a7cd
Message-ID : <20110406223036.GA15721@digium.com>
References : http://marc.info/?l=linux-kernel&m=130212907032580&w=2
Handled-By : Don Zickus <dzickus@redhat.com>
Patch : http://cache.gmane.org//gmane/linux/kernel/1125621-001.bin
For details, please visit the bug entries and follow the links given in
references.
As you can see, there is a Bugzilla entry for each of the listed regressions.
There also is a Bugzilla entry used for tracking the regressions from 2.6.38,
unresolved as well as resolved, at:
http://bugzilla.kernel.org/show_bug.cgi?id=32012
Please let the tracking team know if there are any Bugzilla entries that
should be added to the list in there.
Thanks!
^ permalink raw reply
* 2.6.36-rc3-git7: Reported regressions 2.6.37 -> 2.6.38
From: Rafael J. Wysocki @ 2011-04-17 13:48 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Linux SCSI List, Linux ACPI, Network Development,
Linux Wireless List, DRI, Florian Mickler, Andrew Morton,
Kernel Testers List, Linus Torvalds, Linux PM List,
Maciej Rutecki
This message contains a list of some post-2.6.37 regressions introduced before
2.6.38, for which there are no fixes in the mainline known to the tracking team.
If any of them have been fixed already, please let us know.
If you know of any other unresolved post-2.6.37 regressions, please let us know
either and we'll add them to the list. Also, please let us know if any
of the entries below are invalid.
Each entry from the list will be sent additionally in an automatic reply to
this message with CCs to the people involved in reporting and handling the
issue.
Listed regressions statistics:
Date Total Pending Unresolved
----------------------------------------
2011-04-17 98 28 28
2011-03-27 88 26 26
2011-03-06 70 27 26
2011-02-21 51 18 17
2011-02-12 39 20 18
2011-02-03 19 11 7
Unresolved regressions
----------------------
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32862
Subject : acer_wmi partially crashes ACPI/EC (Aspire 8930G)
Submitter : Hector Martin <hector@marcansoft.com>
Date : 2011-04-07 17:44 (11 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32762
Subject : Booting with external monitor attached results in red flickering screen on the external monitor
Submitter : Anton <anton.bugs@gmail.com>
Date : 2011-04-06 04:50 (12 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32202
Subject : 2.6.38 hangs on boot until key is pressed
Submitter : Tvrtko Ursulin <tvrtko@ursulin.net>
Date : 2011-03-27 19:18 (22 days old)
Message-ID : <1301253485.2500.2.camel@deuteros>
References : http://marc.info/?l=linux-kernel&m=130125411116558&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32112
Subject : Writes to USB flash drives are extremely slow in 2.6.38
Submitter : Delan Azabani <delan@azabani.com>
Date : 2011-03-29 08:10 (20 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=32072
Subject : 2.6.38 Regression: Nvidia GeForce8400 + i915 = Crash on Boot
Submitter : simon@mungewell.org
Date : 2011-03-24 15:20 (25 days old)
Message-ID : <fe471c05897776b7c26b9fd2603e3b76.squirrel@host171.canaca.com>
References : http://marc.info/?l=linux-kernel&m=130100955926434&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31982
Subject : XFS memory allocation deadlock in 2.6.38
Submitter : Sean Noonan <Sean.Noonan@twosigma.com>
Date : 2011-03-21 16:19 (28 days old)
Message-ID : <081DDE43F61F3D43929A181B477DCA95639B52FD@MSXAOA6.twosigma.com>
References : http://marc.info/?l=linux-kernel&m=130072585111310&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31922
Subject : ath5k: Decreased throughput in IBSS or 802.11n mode
Submitter : Jeff Cook <jeff@deserettechnology.com>
Date : 2011-03-26 20:06 (23 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31872
Subject : boot panic unless acpi=off, Thread overran stack, or stack corrupted - Toshiba Satellite/mobile P4
Submitter : Pascal Dormeau <pdormeau@free.fr>
Date : 2011-03-25 20:17 (24 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31782
Subject : nouveau: lockdep spew
Submitter : Johannes Berg <johannes@sipsolutions.net>
Date : 2011-03-24 09:51 (25 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31702
Subject : ath5k phy2: failed to wakeup the MAC Chip
Submitter : Justin P. Mattock <justinmattock@gmail.com>
Date : 2011-03-22 19:15 (27 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31572
Subject : BUG in vb_alloc() - firewire crash at boot
Submitter : Pavel Kysilka <goldenfish@linuxsoft.cz>
Date : 2011-03-21 12:40 (28 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31532
Subject : 2.6.38: Quota over NFS4
Submitter : Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Date : 2011-03-17 13:32 (32 days old)
Message-ID : <20110317133247.GB6424@os.inf.tu-dresden.de>
References : http://marc.info/?l=linux-kernel&m=130036878203485&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31452
Subject : ath9k: throughput issue in 802.11n and also IBSS mode
Submitter : Richard Schütz <r.schtz@t-online.de>
Date : 2011-03-19 19:06 (30 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31402
Subject : Diminished brightness at startup
Submitter : Guilherme Salazar <guilhermesalazar@ymail.com>
Date : 2011-03-18 16:29 (31 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31322
Subject : 2.6.38-rc echo 3 > /proc/sys/vm/drop_caches repairs mplayer distortions
Submitter : Hans de Bruin <jmdebruin@xmsnet.nl>
Date : 2011-03-14 21:34 (35 days old)
Message-ID : <4D7E89E7.3080505@xmsnet.nl>
References : http://marc.info/?l=linux-kernel&m=130014181919827&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=31012
Subject : WARNING: Perf: bad frame pointer = (null), 2.6.38-rc8
Submitter : Chuck Ebbert <cebbert@redhat.com>
Date : 2011-03-12 19:08 (37 days old)
Message-ID : <20110312140851.52420149@katamari>
References : http://marc.info/?l=linux-kernel&m=129995721014931&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=30992
Subject : 2.6.38-rc7: Some strange soft-lockup
Submitter : Dmitry Nezhevenko <dion@inhex.net>
Date : 2011-03-06 14:01 (43 days old)
Message-ID : <20110306140104.GA7700@laptop.local>
References : http://marc.info/?l=linux-kernel&m=129942161205739&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=30852
Subject : Seldom errors after suspend/resume causing problems
Submitter : Mehmet Giritli <mehmet@giritli.eu>
Date : 2011-03-10 10:53 (39 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=30582
Subject : WARNING: at drivers/net/wireless/ath/ath9k/recv.c:536 ath_stoprecv+0xc8/0xda [ath9k]()
Submitter : Justin Mattock <justinmattock@gmail.com>
Date : 2011-03-03 5:47 (46 days old)
Message-ID : <AANLkTik9To0Rkq2FRqQFB2wNu0kyJ7CzyBek2jBp36Cb@mail.gmail.com>
References : http://marc.info/?l=linux-kernel&m=129913127722786&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=29992
Subject : boot hang 2.6.37.1 regression w/ intel_idle and CONFIG_NO_HZ=n - asus p7p55d le
Submitter : De Ganseman Amaury <amaury.deganseman@gmail.com>
Date : 2011-02-27 10:38 (50 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=29852
Subject : 2.6.38-rc5: nfsd: page allocation failure. spinlock trylock failure on UP
Submitter : Alexander Beregalov <a.beregalov@gmail.com>
Date : 2011-02-21 20:33 (56 days old)
Message-ID : <AANLkTi=14N_c_B7mLY0H8Dt8pte6C0mjFnVuC37e44Hs@mail.gmail.com>
References : http://marc.info/?l=linux-netdev&m=129832042402668&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=29672
Subject : [regression][ALSA][hda-conexant][2.6.38-rcX] external microphone sound too quiet
Submitter : Shawn Starr <shawn.starr@rogers.com>
Date : 2011-02-19 6:02 (58 days old)
Message-ID : <474630.25335.qm@smtp105.rog.mail.re2.yahoo.com>
References : http://marc.info/?l=linux-kernel&m=129809536502092&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28802
Subject : commit 5d1d0cc breaks resume from suspend on Thinkpad X201
Submitter : Björn Schließmann <chronoss@gmx.de>
Date : 2011-02-10 17:23 (67 days old)
Handled-By : Chris Wilson <chris@chris-wilson.co.uk>
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28642
Subject : ACPI broken on DELL Latitude E6410 in 2.6.38-rc3
Submitter : Adam Kovari <kovariadam@gmail.com>
Date : 2011-02-08 22:22 (69 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28562
Subject : [BUG] usb problems in .38-rc3+
Submitter : Ed Tomlinson <edt@aei.ca>
Date : 2011-02-05 19:17 (72 days old)
Message-ID : <201102051417.58953.edt@aei.ca>
References : http://marc.info/?l=linux-kernel&m=129693391417607&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28522
Subject : Unable to mount FAT-formatted floppy on /dev/fd0, plus WARN_ON when using /dev/fd0u1440
Submitter : Alex Villacis Lasso <avillaci@ceibo.fiec.espol.edu.ec>
Date : 2011-02-07 17:21 (70 days old)
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28452
Subject : 2.6.38-rc3 regression on parisc: segfaults
Submitter : Meelis Roos <mroos@linux.ee>
Date : 2011-02-01 22:00 (76 days old)
Message-ID : <alpine.SOC.1.00.1102012342200.25944@math.ut.ee>
References : http://marc.info/?l=linux-kernel&m=129659763426600&w=2
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=28422
Subject : kref and apparmor panic in 2.6.38-rc2.
Submitter : Tao Ma <tm@tao.ma>
Date : 2011-01-31 10:06 (77 days old)
Message-ID : <4D46899B.80302@tao.ma>
References : http://marc.info/?l=linux-kernel&m=129646840303149&w=2
Regressions with patches
------------------------
For details, please visit the bug entries and follow the links given in
references.
As you can see, there is a Bugzilla entry for each of the listed regressions.
There also is a Bugzilla entry used for tracking the regressions introduced
between 2.6.37 and 2.6.38, unresolved as well as resolved, at:
http://bugzilla.kernel.org/show_bug.cgi?id=27352
Please let the tracking team know if there are any Bugzilla entries that
should be added to the list in there.
Thanks!
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* [PATCH] r8169: add Realtek as maintainer.
From: Francois Romieu @ 2011-04-17 14:15 UTC (permalink / raw)
To: davem; +Cc: netdev, Hayes Wang, Realtek linux nic maintainers
Per Hayes's request.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
MAINTAINERS | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index ec36003..1e2724e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -151,6 +151,7 @@ S: Maintained
F: drivers/net/hamradio/6pack.c
8169 10/100/1000 GIGABIT ETHERNET DRIVER
+M: Realtek linux nic maintainers <nic_swsd@realtek.com>
M: Francois Romieu <romieu@fr.zoreil.com>
L: netdev@vger.kernel.org
S: Maintained
--
1.7.4.2
^ permalink raw reply related
* Re: r8169 misleading firmware error messages
From: François Romieu @ 2011-04-17 14:38 UTC (permalink / raw)
To: Fejes József; +Cc: netdev
In-Reply-To: <4DA9864E.2070405@joco.name>
On Sat, Apr 16, 2011 at 02:06:38PM +0200, Fejes József wrote:
[...]
> I meant this:
>
> 2233 if ((rtl_readphy(tp, 0x06) != 0xbf00) ||
> 2234 (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) {
> 2235 netif_warn(tp, probe, tp->dev, "unable to apply
> firmware patch\n");
> 2236 }
Ok.
This part is about to be reworked in Linus's tree.
[...]
> I took a deeper look. It seems to me that the firmware files are not
> the usual microcode type that the device can't function without, it
> just sets up some registers, which supposedly already contain some
> sensible values, so it's more like patching. That explains why this
> device still works without the firmware. So my actual question is
> this: what do I gain if I use the firmware, what do I lose if I
> don't ?
As Ben stated, if everything seems ok with your link partner and you
do not use the firmware, using the firmware will not make things work
better.
--
Ueimor
^ permalink raw reply
* RE: [PATCH] net: benet: convert to hw_features - fixup
From: Ajit.Khaparde @ 2011-04-17 16:14 UTC (permalink / raw)
To: mirq-linux, netdev; +Cc: Sathya.Perla, subbu.seetharaman
In-Reply-To: <20110417101547.5F75513A6A@rere.qmqm.pl>
> Remove be_set_flags() as it's already covered by hw_features.
> Signed-off-by: Michał Mirosław mirq-linux@rere.qmqm.pl
Acked-by: Ajit Khaparde ajit.khaparde@emulex.com
> ---
> drivers/net/benet/be_ethtool.c | 13 -------------
> 1 files changed, 0 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
> index 80226e4..ab7ebdd 100644
> --- a/drivers/net/benet/be_ethtool.c
> +++ b/drivers/net/benet/be_ethtool.c
> @@ -716,18 +716,6 @@ be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
> return status;
> }
> -static int be_set_flags(struct net_device *netdev, u32 data)
> -{
> - struct be_adapter *adapter = netdev_priv(netdev);
> - int rc = -1;
> -
> - if (be_multi_rxq(adapter))
> - rc = ethtool_op_set_flags(netdev, data, ETH_FLAG_RXHASH |
> - ETH_FLAG_TXVLAN | ETH_FLAG_RXVLAN);
> -
> - return rc;
> -}
> -
> const struct ethtool_ops be_ethtool_ops = {
> .get_settings = be_get_settings,
> .get_drvinfo = be_get_drvinfo,
> @@ -749,5 +737,4 @@ const struct ethtool_ops be_ethtool_ops = {
> .get_regs = be_get_regs,
> .flash_device = be_do_flash,
> .self_test = be_self_test,
> - .set_flags = be_set_flags,
> };
> --
> 1.7.2.5
>
^ permalink raw reply
* Re: Suspend/resume - slow resume
From: Linus Torvalds @ 2011-04-17 16:42 UTC (permalink / raw)
To: Francois Romieu
Cc: Ciprian Docan, netdev, Linux Kernel Mailing List, Len Brown,
Pavel Machek, Rafael, J. Wysocki
In-Reply-To: <20110417101731.GA17986@electric-eye.fr.zoreil.com>
On Sun, Apr 17, 2011 at 3:17 AM, Francois Romieu <romieu@fr.zoreil.com> wrote:
>
> One can try the patch below. It is completely untested yet.
Looks _fairly_ sane to me. The "request firmware in open, release
firmware in close" approach would seem to be a fairly obvious one.
HOWEVER.
I think it's broken in two ways:
- it causes too much re-loading for no good reason. I'm looking at
rtl8169_reinit_task() in particular, and if I read that correctly,
then if there are any problems, that crazy function will end up
loading and unloading the firmware EVERY FOUR TIMER TICKS!
That's just totally broken.
But I'd also worry about some init scripts in particular, maybe
that whole "open to test something, close immediately" is common. I
don't know.
- it seems to leak the open function fails after requesting the
firmware - nothing will ever close it, and if you unload the module
the firmware will never be released as far as I can tell.
I might be missing some failure path (maybe the network device open
will call close even if the open failed), but it looks real.
So I think your patch _approaches_ being sane, but no, it's not working as-is.
I really think that this kind of "ad-hoc random firmware loading"
stuff should go away. The device layer (or maybe the network layer)
should have some clear and unambiguous rules. Exactly so that drivers
don't make these kinds of mistakes.
My gut feel for what the rules should be is roughly (but please take
this as a starting point for discussion rather than some final thing):
- try to load the firmware at each time the user tries to activate
the device. IOW, not like this, where the rtl8169_open() function is
called from many different contexts, only one of them being the
"network layer tried to open the device".
I do think we need to do it potentially multiple times: the main
issue being something like this:
ifconfig eth0 up
** oops, that failed because we didn't have the firmware files
installed **
... install firmware files, the 'dmesg' gave good error messages
that the user could use to know what was going on ..
ifconfig eth0 up
** this needs to trigger another firmware load attempt **
In other words, doing firmware load at module load time - or at
device scan time - is fundamentally broken for a network driver.
- unload not on close, but on device unregister (iow not when you do
"ifconfig eth0 down", but when the "eth0" device really goes away)
But as mentioned, the above is (a) just my gut feel - please discuss -
and (b) I really think that leaving this to the network driver has
been shown to continually result in the drivers doing the firmware
load/unload in all the wrong places.
So I do wonder whether we could add a "ndo_firmware_load()" and
"ndo_firmware_unload()" callback to the network device operations, and
have the network layer make the above rules. A network driver
obviously _could_ do its firmware load from other places instead, but
such a network driver would basically be "obviously broken".
Comments?
(That said, I think that Francois' patch could be made acceptable
fairly trivially:
- avoiding the load/unload from rtl8169_reinit_task() and that
horrible "every four timer ticks" issue. That just seems crazy. Maybe
by just having an internal open helper function that does everything
but the firmware load)
- adding a rtl_release_firmware on open failure so that you don't leak stuff
but I do think that this whole "firmware load in random places" has
been such a common bug that I think we should have some real rules
about it)
Hmm?
Linus
^ permalink raw reply
* Re: net: Automatic IRQ siloing for network devices
From: Neil Horman @ 2011-04-17 17:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Ben Hutchings, netdev, davem
In-Reply-To: <20110416091704.4fa62a50@nehalam>
On Sat, Apr 16, 2011 at 09:17:04AM -0700, Stephen Hemminger wrote:
> On Fri, 15 Apr 2011 21:59:38 -0400
> Neil Horman <nhorman@tuxdriver.com> wrote:
>
> > On Fri, Apr 15, 2011 at 11:54:29PM +0100, Ben Hutchings wrote:
> > > On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > > > Automatic IRQ siloing for network devices
> > > >
> > > > At last years netconf:
> > > > http://vger.kernel.org/netconf2010.html
> > > >
> > > > Tom Herbert gave a talk in which he outlined some of the things we can do to
> > > > improve scalability and througput in our network stack
> > > >
> > > > One of the big items on the slides was the notion of siloing irqs, which is the
> > > > practice of setting irq affinity to a cpu or cpu set that was 'close' to the
> > > > process that would be consuming data. The idea was to ensure that a hard irq
> > > > for a nic (and its subsequent softirq) would execute on the same cpu as the
> > > > process consuming the data, increasing cache hit rates and speeding up overall
> > > > throughput.
> > > >
> > > > I had taken an idea away from that talk, and have finally gotten around to
> > > > implementing it. One of the problems with the above approach is that its all
> > > > quite manual. I.e. to properly enact this siloiong, you have to do a few things
> > > > by hand:
> > > >
> > > > 1) decide which process is the heaviest user of a given rx queue
> > > > 2) restrict the cpus which that task will run on
> > > > 3) identify the irq which the rx queue in (1) maps to
> > > > 4) manually set the affinity for the irq in (3) to cpus which match the cpus in
> > > > (2)
> > > [...]
> > >
> > > This presumably works well with small numbers of flows and/or large
> > > numbers of queues. You could scale it up somewhat by manipulating the
> > > device's flow hash indirection table, but that usually only has 128
> > > entries. (Changing the indirection table is currently quite expensive,
> > > though that could be changed.)
> > >
> > > I see RFS and accelerated RFS as the only reasonable way to scale to
> > > large numbers of flows. And as part of accelerated RFS, I already did
> > > the work for mapping CPUs to IRQs (note, not the other way round). If
> > > IRQ affinity keeps changing then it will significantly undermine the
> > > usefulness of hardware flow steering.
> > >
> > > Now I'm not saying that your approach is useless. There is more
> > > hardware out there with flow hashing than with flow steering, and there
> > > are presumably many systems with small numbers of active flows. But I
> > > think we need to avoid having two features that conflict and a
> > > requirement for administrators to make a careful selection between them.
> > >
> > > Ben.
> > >
> > I hear what your saying and I agree, theres no point in having features work
> > against each other. That said, I'm not sure I agree that these features have to
> > work against one another, nor does a sysadmin need to make a choice between the
> > two. Note the third patch in this series. Making this work requires that
> > network drivers wanting to participate in this affinity algorithm opt in by
> > using the request_net_irq macro to attach the interrupt to the rfs affinity code
> > that I added. Theres no reason that a driver which supports hardware that still
> > uses flow steering can't opt out of this algorithm, and as a result irqbalance
> > will still treat those interrupts as it normally does. And for those drivers
> > which do opt in, irqbalance can take care of affinity assignment, using the
> > provided hint. No need for sysadmin intervention.
> >
> > I'm sure there can be improvements made to this code, but I think theres less
> > conflict between the work you've done and this code than there appears to be at
> > first blush.
> >
>
> My gut feeling is that:
> * kernel should default to a simple static sane irq policy without user
> space. This is especially true for multi-queue devices where the default
> puts all IRQ's on one cpu.
>
Thats not how it currently works, AFAICS. The default kernel policy is
currently that cpu affinity for any newly requested irq is all cpus. Any
restriction beyond that is the purview and doing of userspace (irqbalance or
manual affinity setting).
> * irqbalance should do a one-shot rearrangement at boot up. It should rearrange
> when new IRQ's are requested. The kernel should have capablity to notify
> userspace (uevent?) when IRQ's are added or removed.
>
I can see that, and it would be easy to implement. That said, I'm not sure what
criteria should be used when doing said re-arrangement. Currently irqbalance
uses interrupt counts and names to determine how interrupts should be placed.
That is of course a hack, but its done because its currently the best
information available to user space. Thats what this patch series was hoping to
address. By exporting RFS flow data we give the opportunity to irqbalance to do
some modicum of better irq placement.
> * Let scheduler make decisions about migrating processes (rather than let irqbalance
> migrate IRQ's).
>
I can certainly get behind this idea, I've been having trouble however comming
up with a good algorithm that lets the scheduler make a rational decision about
which cpu to run a process on. I.e. how to do you weigh moving a process to a
cpu thats more local to the rx queue its reciving data on against the fact that
its also sharing a memory segment with another process on its current cpu. I'd
like to be able to normalize these comparisons, but I'm not at all sure (yet)
how to do so.
> * irqbalance should not do the hacks it does to try and guess at network traffic.
>
Well, I can certainly agree with that, but I'm not sure what that looks like.
I could envision something like:
1) Use irqbalance to do a one time placement of interrupts, keeping a simple
(possibly sub-optimal) policy, perhaps something like new irqs get assigned to
the least loaded cpu within the numa node of the device the irq is originating
from.
2) Add a udev event on the addition of new interrupts, to rerun irqbalance
3) Add some exported information to identify processes that are high users of
network traffic, and correlate that usage to a rxq/irq that produces that
information (possibly some per-task proc file)
4) Create/expand an additional user space daemon to monitor the highest users of
network traffic on various rxq/irqs (as identified in (3)) and restrict those
processes execution to those cpus which are on the same L2 cache as the irq
itself. The cpuset cgroup could be usefull in doing this perhaps.
Actually, as I read back to myself, that acutally sounds kind of good to me. It
keeps all the policy for this in user space, and minimizes what we have to add
to the kernel to make it happen (some process information in /proc and another
udev event). I'd like to get some feedback before I start implementing this,
but I think this could be done. What do you think?
Thanks & Regards
Neil
^ permalink raw reply
* Re: net: Automatic IRQ siloing for network devices
From: Ben Hutchings @ 2011-04-17 18:38 UTC (permalink / raw)
To: Neil Horman; +Cc: Stephen Hemminger, netdev, davem, Thomas Gleixner
In-Reply-To: <20110417172010.GA3362@neilslaptop.think-freely.org>
On Sun, 2011-04-17 at 13:20 -0400, Neil Horman wrote:
> On Sat, Apr 16, 2011 at 09:17:04AM -0700, Stephen Hemminger wrote:
[...]
> > My gut feeling is that:
> > * kernel should default to a simple static sane irq policy without user
> > space. This is especially true for multi-queue devices where the default
> > puts all IRQ's on one cpu.
> >
> Thats not how it currently works, AFAICS. The default kernel policy is
> currently that cpu affinity for any newly requested irq is all cpus. Any
> restriction beyond that is the purview and doing of userspace (irqbalance or
> manual affinity setting).
Right. Though it may be reasonable for the kernel to use the hint as
the initial affinity for a newly allocated IRQ (not sure quite how we
determine that).
[...]
> > * irqbalance should not do the hacks it does to try and guess at network traffic.
> >
> Well, I can certainly agree with that, but I'm not sure what that looks like.
>
> I could envision something like:
>
> 1) Use irqbalance to do a one time placement of interrupts, keeping a simple
> (possibly sub-optimal) policy, perhaps something like new irqs get assigned to
> the least loaded cpu within the numa node of the device the irq is originating
> from.
>
> 2) Add a udev event on the addition of new interrupts, to rerun irqbalance
Yes, making irqbalance more (or entirely) event-driven seems like a good
thing.
> 3) Add some exported information to identify processes that are high users of
> network traffic, and correlate that usage to a rxq/irq that produces that
> information (possibly some per-task proc file)
>
> 4) Create/expand an additional user space daemon to monitor the highest users of
> network traffic on various rxq/irqs (as identified in (3)) and restrict those
> processes execution to those cpus which are on the same L2 cache as the irq
> itself. The cpuset cgroup could be usefull in doing this perhaps.
I just don't see that you're going to get processes associated with
specific RX queues unless you make use of flow steering.
The 128-entry flow hash indirection table is part of Microsoft's
requirements for RSS so most multiqueue hardware is going to let you do
limited flow steering that way.
> Actually, as I read back to myself, that acutally sounds kind of good to me. It
> keeps all the policy for this in user space, and minimizes what we have to add
> to the kernel to make it happen (some process information in /proc and another
> udev event). I'd like to get some feedback before I start implementing this,
> but I think this could be done. What do you think?
I don't think it's a good idea to override the scheduler dynamically
like this.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* pull request: batman-adv 2011-04-17
From: Sven Eckelmann @ 2011-04-17 19:30 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
Hi,
I would like to propose following patches for net-next-2.6/2.6.40. Most of the
stuff is cleanup work to reduce the locking complexity. The only exception is
Andrew Lunn's patch, which only adds the initialisation of tx_queue_len.
thanks,
Sven
The following changes since commit 0ce790e7d736cedc563e1fb4e998babf5a4dbc3d:
Linux 2.6.39-rc1 (2011-03-29 12:09:47 -0700)
are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/next
Andrew Lunn (1):
batman-adv: Set the txqueuelen to zero when creating soft interface
Linus Lüssing (5):
batman-adv: Move bonding / iface alternating router search to own functions
batman-adv: Make gateway_get_selected type safe
batman-adv: Simplify gw_check_election(), use gw_get_selected()
batman-adv: Make orig_node->router an rcu protected pointer
batman-adv: Protect global TQ window with a spinlock
Marek Lindner (1):
batman-adv: concentrate all curr_gw related rcu operations in select/deselect functions
Simon Wunderlich (1):
batman-adv: protect softif_neigh by rcu
net/batman-adv/gateway_client.c | 259 ++++++++++++++++-----------
net/batman-adv/gateway_client.h | 2 +-
net/batman-adv/icmp_socket.c | 18 +--
net/batman-adv/originator.c | 38 +++-
net/batman-adv/originator.h | 1 +
net/batman-adv/routing.c | 378 +++++++++++++++++++++------------------
net/batman-adv/send.c | 19 ++-
net/batman-adv/soft-interface.c | 115 +++++++++---
net/batman-adv/types.h | 7 +-
net/batman-adv/unicast.c | 2 +-
net/batman-adv/vis.c | 91 +++++-----
11 files changed, 537 insertions(+), 393 deletions(-)
^ permalink raw reply
* [PATCH 1/8] batman-adv: Move bonding / iface alternating router search to own functions
From: Sven Eckelmann @ 2011-04-17 19:30 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Marek Lindner
In-Reply-To: <1303068618-27928-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
From: Linus Lüssing <linus.luessing-S0/GAf8tV78@public.gmane.org>
This decreases the size of find_router() by outsourcing the router
search for the bonding and interface alternating modes to their own sub
functions. This shall make it easier to keep track of the correct
refcounting later.
Signed-off-by: Linus Lüssing <linus.luessing-S0/GAf8tV78@public.gmane.org>
Signed-off-by: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
---
net/batman-adv/routing.c | 180 +++++++++++++++++++++++++++-------------------
1 files changed, 105 insertions(+), 75 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index c172f5d..f212abe 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1092,6 +1092,106 @@ out:
return ret;
}
+/* In the bonding case, send the packets in a round
+ * robin fashion over the remaining interfaces.
+ *
+ * This method rotates the bonding list and increases the
+ * returned router's refcount. */
+static struct neigh_node *find_bond_router(struct orig_node *primary_orig,
+ struct hard_iface *recv_if)
+{
+ struct neigh_node *tmp_neigh_node;
+ struct neigh_node *router = NULL, *first_candidate = NULL;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list,
+ bonding_list) {
+ if (!first_candidate)
+ first_candidate = tmp_neigh_node;
+
+ /* recv_if == NULL on the first node. */
+ if (tmp_neigh_node->if_incoming == recv_if)
+ continue;
+
+ if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
+ continue;
+
+ router = tmp_neigh_node;
+ break;
+ }
+
+ /* use the first candidate if nothing was found. */
+ if (!router && first_candidate &&
+ atomic_inc_not_zero(&first_candidate->refcount))
+ router = first_candidate;
+
+ if (!router)
+ goto out;
+
+ /* selected should point to the next element
+ * after the current router */
+ spin_lock_bh(&primary_orig->neigh_list_lock);
+ /* this is a list_move(), which unfortunately
+ * does not exist as rcu version */
+ list_del_rcu(&primary_orig->bond_list);
+ list_add_rcu(&primary_orig->bond_list,
+ &router->bonding_list);
+ spin_unlock_bh(&primary_orig->neigh_list_lock);
+
+out:
+ rcu_read_unlock();
+ return router;
+}
+
+/* Interface Alternating: Use the best of the
+ * remaining candidates which are not using
+ * this interface.
+ *
+ * Increases the returned router's refcount */
+static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig,
+ struct hard_iface *recv_if)
+{
+ struct neigh_node *tmp_neigh_node;
+ struct neigh_node *router = NULL, *first_candidate = NULL;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list,
+ bonding_list) {
+ if (!first_candidate)
+ first_candidate = tmp_neigh_node;
+
+ /* recv_if == NULL on the first node. */
+ if (tmp_neigh_node->if_incoming == recv_if)
+ continue;
+
+ if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
+ continue;
+
+ /* if we don't have a router yet
+ * or this one is better, choose it. */
+ if ((!router) ||
+ (tmp_neigh_node->tq_avg > router->tq_avg)) {
+ /* decrement refcount of
+ * previously selected router */
+ if (router)
+ neigh_node_free_ref(router);
+
+ router = tmp_neigh_node;
+ atomic_inc_not_zero(&router->refcount);
+ }
+
+ neigh_node_free_ref(tmp_neigh_node);
+ }
+
+ /* use the first candidate if nothing was found. */
+ if (!router && first_candidate &&
+ atomic_inc_not_zero(&first_candidate->refcount))
+ router = first_candidate;
+
+ rcu_read_unlock();
+ return router;
+}
+
/* find a suitable router for this originator, and use
* bonding if possible. increases the found neighbors
* refcount.*/
@@ -1101,7 +1201,7 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
{
struct orig_node *primary_orig_node;
struct orig_node *router_orig;
- struct neigh_node *router, *first_candidate, *tmp_neigh_node;
+ struct neigh_node *router;
static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
int bonding_enabled;
@@ -1157,82 +1257,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
* in. */
neigh_node_free_ref(router);
- first_candidate = NULL;
- router = NULL;
- if (bonding_enabled) {
- /* in the bonding case, send the packets in a round
- * robin fashion over the remaining interfaces. */
+ if (bonding_enabled)
+ router = find_bond_router(primary_orig_node, recv_if);
+ else
+ router = find_ifalter_router(primary_orig_node, recv_if);
- list_for_each_entry_rcu(tmp_neigh_node,
- &primary_orig_node->bond_list, bonding_list) {
- if (!first_candidate)
- first_candidate = tmp_neigh_node;
- /* recv_if == NULL on the first node. */
- if (tmp_neigh_node->if_incoming != recv_if &&
- atomic_inc_not_zero(&tmp_neigh_node->refcount)) {
- router = tmp_neigh_node;
- break;
- }
- }
-
- /* use the first candidate if nothing was found. */
- if (!router && first_candidate &&
- atomic_inc_not_zero(&first_candidate->refcount))
- router = first_candidate;
-
- if (!router) {
- rcu_read_unlock();
- return NULL;
- }
-
- /* selected should point to the next element
- * after the current router */
- spin_lock_bh(&primary_orig_node->neigh_list_lock);
- /* this is a list_move(), which unfortunately
- * does not exist as rcu version */
- list_del_rcu(&primary_orig_node->bond_list);
- list_add_rcu(&primary_orig_node->bond_list,
- &router->bonding_list);
- spin_unlock_bh(&primary_orig_node->neigh_list_lock);
-
- } else {
- /* if bonding is disabled, use the best of the
- * remaining candidates which are not using
- * this interface. */
- list_for_each_entry_rcu(tmp_neigh_node,
- &primary_orig_node->bond_list, bonding_list) {
- if (!first_candidate)
- first_candidate = tmp_neigh_node;
-
- /* recv_if == NULL on the first node. */
- if (tmp_neigh_node->if_incoming == recv_if)
- continue;
-
- if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
- continue;
-
- /* if we don't have a router yet
- * or this one is better, choose it. */
- if ((!router) ||
- (tmp_neigh_node->tq_avg > router->tq_avg)) {
- /* decrement refcount of
- * previously selected router */
- if (router)
- neigh_node_free_ref(router);
-
- router = tmp_neigh_node;
- atomic_inc_not_zero(&router->refcount);
- }
-
- neigh_node_free_ref(tmp_neigh_node);
- }
-
- /* use the first candidate if nothing was found. */
- if (!router && first_candidate &&
- atomic_inc_not_zero(&first_candidate->refcount))
- router = first_candidate;
- }
return_router:
rcu_read_unlock();
return router;
--
1.7.4.4
^ permalink raw reply related
* [PATCH 2/8] batman-adv: Make gateway_get_selected type safe
From: Sven Eckelmann @ 2011-04-17 19:30 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Marek Lindner
In-Reply-To: <1303068618-27928-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
From: Linus Lüssing <linus.luessing-S0/GAf8tV78@public.gmane.org>
Make the return value explicit instead of (void *).
Signed-off-by: Linus Lüssing <linus.luessing-S0/GAf8tV78@public.gmane.org>
Signed-off-by: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
---
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/gateway_client.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 3cc4355..27b87ad 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -42,7 +42,7 @@ static void gw_node_free_ref(struct gw_node *gw_node)
call_rcu(&gw_node->rcu, gw_node_free_rcu);
}
-void *gw_get_selected(struct bat_priv *bat_priv)
+struct orig_node *gw_get_selected(struct bat_priv *bat_priv)
{
struct gw_node *curr_gateway_tmp;
struct orig_node *orig_node = NULL;
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h
index 2aa4391..97c31d1 100644
--- a/net/batman-adv/gateway_client.h
+++ b/net/batman-adv/gateway_client.h
@@ -24,7 +24,7 @@
void gw_deselect(struct bat_priv *bat_priv);
void gw_election(struct bat_priv *bat_priv);
-void *gw_get_selected(struct bat_priv *bat_priv);
+struct orig_node *gw_get_selected(struct bat_priv *bat_priv);
void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node);
void gw_node_update(struct bat_priv *bat_priv,
struct orig_node *orig_node, uint8_t new_gwflags);
--
1.7.4.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox