Skip to content

Commit 4cea870

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: wimax/i2400m: fix missing endian correction read in fw loader net8139: fix a race at the end of NAPI pktgen: Fix accuracy of inter-packet delay. pkt_sched: gen_estimator: add a new lock net: deliver skbs on inactive slaves to exact matches ipv6: fix ICMP6_MIB_OUTERRORS r8169: fix mdio_read and update mdio_write according to hw specs gianfar: Revive the driver for eTSEC devices (disable timestamping) caif: fix a couple range checks phylib: Add support for the LXT973 phy. net: Print num_rx_queues imbalance warning only when there are allocated queues
2 parents 7ae1277 + e79aa86 commit 4cea870

File tree

14 files changed

+103
-28
lines changed

14 files changed

+103
-28
lines changed

drivers/net/8139cp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,8 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
598598
goto rx_status_loop;
599599

600600
spin_lock_irqsave(&cp->lock, flags);
601-
cpw16_f(IntrMask, cp_intr_mask);
602601
__napi_complete(napi);
602+
cpw16_f(IntrMask, cp_intr_mask);
603603
spin_unlock_irqrestore(&cp->lock, flags);
604604
}
605605

drivers/net/8139too.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,8 +2089,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
20892089
* again when we think we are done.
20902090
*/
20912091
spin_lock_irqsave(&tp->lock, flags);
2092-
RTL_W16_F(IntrMask, rtl8139_intr_mask);
20932092
__napi_complete(napi);
2093+
RTL_W16_F(IntrMask, rtl8139_intr_mask);
20942094
spin_unlock_irqrestore(&tp->lock, flags);
20952095
}
20962096
spin_unlock(&tp->rx_lock);

drivers/net/gianfar.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
747747
FSL_GIANFAR_DEV_HAS_CSUM |
748748
FSL_GIANFAR_DEV_HAS_VLAN |
749749
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET |
750-
FSL_GIANFAR_DEV_HAS_EXTENDED_HASH |
751-
FSL_GIANFAR_DEV_HAS_TIMER;
750+
FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
752751

753752
ctype = of_get_property(np, "phy-connection-type", NULL);
754753

drivers/net/phy/lxt.c

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353

5454
#define MII_LXT971_ISR 19 /* Interrupt Status Register */
5555

56+
/* register definitions for the 973 */
57+
#define MII_LXT973_PCR 16 /* Port Configuration Register */
58+
#define PCR_FIBER_SELECT 1
5659

5760
MODULE_DESCRIPTION("Intel LXT PHY driver");
5861
MODULE_AUTHOR("Andy Fleming");
@@ -119,6 +122,33 @@ static int lxt971_config_intr(struct phy_device *phydev)
119122
return err;
120123
}
121124

125+
static int lxt973_probe(struct phy_device *phydev)
126+
{
127+
int val = phy_read(phydev, MII_LXT973_PCR);
128+
129+
if (val & PCR_FIBER_SELECT) {
130+
/*
131+
* If fiber is selected, then the only correct setting
132+
* is 100Mbps, full duplex, and auto negotiation off.
133+
*/
134+
val = phy_read(phydev, MII_BMCR);
135+
val |= (BMCR_SPEED100 | BMCR_FULLDPLX);
136+
val &= ~BMCR_ANENABLE;
137+
phy_write(phydev, MII_BMCR, val);
138+
/* Remember that the port is in fiber mode. */
139+
phydev->priv = lxt973_probe;
140+
} else {
141+
phydev->priv = NULL;
142+
}
143+
return 0;
144+
}
145+
146+
static int lxt973_config_aneg(struct phy_device *phydev)
147+
{
148+
/* Do nothing if port is in fiber mode. */
149+
return phydev->priv ? 0 : genphy_config_aneg(phydev);
150+
}
151+
122152
static struct phy_driver lxt970_driver = {
123153
.phy_id = 0x78100000,
124154
.name = "LXT970",
@@ -146,6 +176,18 @@ static struct phy_driver lxt971_driver = {
146176
.driver = { .owner = THIS_MODULE,},
147177
};
148178

179+
static struct phy_driver lxt973_driver = {
180+
.phy_id = 0x00137a10,
181+
.name = "LXT973",
182+
.phy_id_mask = 0xfffffff0,
183+
.features = PHY_BASIC_FEATURES,
184+
.flags = 0,
185+
.probe = lxt973_probe,
186+
.config_aneg = lxt973_config_aneg,
187+
.read_status = genphy_read_status,
188+
.driver = { .owner = THIS_MODULE,},
189+
};
190+
149191
static int __init lxt_init(void)
150192
{
151193
int ret;
@@ -157,9 +199,15 @@ static int __init lxt_init(void)
157199
ret = phy_driver_register(&lxt971_driver);
158200
if (ret)
159201
goto err2;
202+
203+
ret = phy_driver_register(&lxt973_driver);
204+
if (ret)
205+
goto err3;
160206
return 0;
161207

162-
err2:
208+
err3:
209+
phy_driver_unregister(&lxt971_driver);
210+
err2:
163211
phy_driver_unregister(&lxt970_driver);
164212
err1:
165213
return ret;
@@ -169,6 +217,7 @@ static void __exit lxt_exit(void)
169217
{
170218
phy_driver_unregister(&lxt970_driver);
171219
phy_driver_unregister(&lxt971_driver);
220+
phy_driver_unregister(&lxt973_driver);
172221
}
173222

174223
module_init(lxt_init);

drivers/net/r8169.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,10 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value)
560560
udelay(25);
561561
}
562562
/*
563-
* Some configurations require a small delay even after the write
564-
* completed indication or the next write might fail.
563+
* According to hardware specs a 20us delay is required after write
564+
* complete indication, but before sending next command.
565565
*/
566-
udelay(25);
566+
udelay(20);
567567
}
568568

569569
static int mdio_read(void __iomem *ioaddr, int reg_addr)
@@ -583,6 +583,12 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr)
583583
}
584584
udelay(25);
585585
}
586+
/*
587+
* According to hardware specs a 20us delay is required after read
588+
* complete indication, but before sending next command.
589+
*/
590+
udelay(20);
591+
586592
return value;
587593
}
588594

drivers/net/wimax/i2400m/fw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ int i2400m_fw_hdr_check(struct i2400m *i2400m,
11921192
unsigned module_type, header_len, major_version, minor_version,
11931193
module_id, module_vendor, date, size;
11941194

1195-
module_type = bcf_hdr->module_type;
1195+
module_type = le32_to_cpu(bcf_hdr->module_type);
11961196
header_len = sizeof(u32) * le32_to_cpu(bcf_hdr->header_len);
11971197
major_version = (le32_to_cpu(bcf_hdr->header_version) & 0xffff0000)
11981198
>> 16;

include/linux/skbuff.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ struct sk_buff {
380380
kmemcheck_bitfield_begin(flags2);
381381
__u16 queue_mapping:16;
382382
#ifdef CONFIG_IPV6_NDISC_NODETYPE
383-
__u8 ndisc_nodetype:2;
383+
__u8 ndisc_nodetype:2,
384+
deliver_no_wcard:1;
385+
#else
386+
__u8 deliver_no_wcard:1;
384387
#endif
385388
kmemcheck_bitfield_end(flags2);
386389

net/8021q/vlan_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
1212
return NET_RX_DROP;
1313

1414
if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master)))
15-
goto drop;
15+
skb->deliver_no_wcard = 1;
1616

1717
skb->skb_iif = skb->dev->ifindex;
1818
__vlan_hwaccel_put_tag(skb, vlan_tci);
@@ -84,7 +84,7 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
8484
struct sk_buff *p;
8585

8686
if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master)))
87-
goto drop;
87+
skb->deliver_no_wcard = 1;
8888

8989
skb->skb_iif = skb->dev->ifindex;
9090
__vlan_hwaccel_put_tag(skb, vlan_tci);

net/caif/cfrfml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
8383
if (!cfsrvl_ready(service, &ret))
8484
return ret;
8585

86-
if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
86+
if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
8787
pr_err("CAIF: %s():Packet too large - size=%d\n",
8888
__func__, cfpkt_getlen(pkt));
8989
return -EOVERFLOW;

net/caif/cfveil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt)
8484
return ret;
8585
caif_assert(layr->dn != NULL);
8686
caif_assert(layr->dn->transmit != NULL);
87-
if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
87+
if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
8888
pr_warning("CAIF: %s(): Packet too large - size=%d\n",
8989
__func__, cfpkt_getlen(pkt));
9090
return -EOVERFLOW;

net/core/dev.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,11 +2253,9 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
22532253
if (skb_rx_queue_recorded(skb)) {
22542254
u16 index = skb_get_rx_queue(skb);
22552255
if (unlikely(index >= dev->num_rx_queues)) {
2256-
if (net_ratelimit()) {
2257-
pr_warning("%s received packet on queue "
2258-
"%u, but number of RX queues is %u\n",
2259-
dev->name, index, dev->num_rx_queues);
2260-
}
2256+
WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
2257+
"on queue %u, but number of RX queues is %u\n",
2258+
dev->name, index, dev->num_rx_queues);
22612259
goto done;
22622260
}
22632261
rxqueue = dev->_rx + index;
@@ -2812,13 +2810,24 @@ static int __netif_receive_skb(struct sk_buff *skb)
28122810
if (!skb->skb_iif)
28132811
skb->skb_iif = skb->dev->ifindex;
28142812

2813+
/*
2814+
* bonding note: skbs received on inactive slaves should only
2815+
* be delivered to pkt handlers that are exact matches. Also
2816+
* the deliver_no_wcard flag will be set. If packet handlers
2817+
* are sensitive to duplicate packets these skbs will need to
2818+
* be dropped at the handler. The vlan accel path may have
2819+
* already set the deliver_no_wcard flag.
2820+
*/
28152821
null_or_orig = NULL;
28162822
orig_dev = skb->dev;
28172823
master = ACCESS_ONCE(orig_dev->master);
2818-
if (master) {
2819-
if (skb_bond_should_drop(skb, master))
2824+
if (skb->deliver_no_wcard)
2825+
null_or_orig = orig_dev;
2826+
else if (master) {
2827+
if (skb_bond_should_drop(skb, master)) {
2828+
skb->deliver_no_wcard = 1;
28202829
null_or_orig = orig_dev; /* deliver only exact match */
2821-
else
2830+
} else
28222831
skb->dev = master;
28232832
}
28242833

net/core/gen_estimator.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static DEFINE_RWLOCK(est_lock);
107107

108108
/* Protects against soft lockup during large deletion */
109109
static struct rb_root est_root = RB_ROOT;
110+
static DEFINE_SPINLOCK(est_tree_lock);
110111

111112
static void est_timer(unsigned long arg)
112113
{
@@ -201,7 +202,6 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats
201202
*
202203
* Returns 0 on success or a negative error code.
203204
*
204-
* NOTE: Called under rtnl_mutex
205205
*/
206206
int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
207207
struct gnet_stats_rate_est *rate_est,
@@ -232,6 +232,7 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
232232
est->last_packets = bstats->packets;
233233
est->avpps = rate_est->pps<<10;
234234

235+
spin_lock(&est_tree_lock);
235236
if (!elist[idx].timer.function) {
236237
INIT_LIST_HEAD(&elist[idx].list);
237238
setup_timer(&elist[idx].timer, est_timer, idx);
@@ -242,6 +243,7 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
242243

243244
list_add_rcu(&est->list, &elist[idx].list);
244245
gen_add_node(est);
246+
spin_unlock(&est_tree_lock);
245247

246248
return 0;
247249
}
@@ -261,13 +263,13 @@ static void __gen_kill_estimator(struct rcu_head *head)
261263
*
262264
* Removes the rate estimator specified by &bstats and &rate_est.
263265
*
264-
* NOTE: Called under rtnl_mutex
265266
*/
266267
void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
267268
struct gnet_stats_rate_est *rate_est)
268269
{
269270
struct gen_estimator *e;
270271

272+
spin_lock(&est_tree_lock);
271273
while ((e = gen_find_node(bstats, rate_est))) {
272274
rb_erase(&e->node, &est_root);
273275

@@ -278,6 +280,7 @@ void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
278280
list_del_rcu(&e->list);
279281
call_rcu(&e->e_rcu, __gen_kill_estimator);
280282
}
283+
spin_unlock(&est_tree_lock);
281284
}
282285
EXPORT_SYMBOL(gen_kill_estimator);
283286

@@ -312,8 +315,14 @@ EXPORT_SYMBOL(gen_replace_estimator);
312315
bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
313316
const struct gnet_stats_rate_est *rate_est)
314317
{
318+
bool res;
319+
315320
ASSERT_RTNL();
316321

317-
return gen_find_node(bstats, rate_est) != NULL;
322+
spin_lock(&est_tree_lock);
323+
res = gen_find_node(bstats, rate_est) != NULL;
324+
spin_unlock(&est_tree_lock);
325+
326+
return res;
318327
}
319328
EXPORT_SYMBOL(gen_estimator_active);

net/core/pktgen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
21702170
end_time = ktime_now();
21712171

21722172
pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time));
2173-
pkt_dev->next_tx = ktime_add_ns(end_time, pkt_dev->delay);
2173+
pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay);
21742174
}
21752175

21762176
static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev)

net/ipv6/icmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
483483
np->tclass, NULL, &fl, (struct rt6_info*)dst,
484484
MSG_DONTWAIT, np->dontfrag);
485485
if (err) {
486-
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
486+
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
487487
ip6_flush_pending_frames(sk);
488488
goto out_put;
489489
}
@@ -565,7 +565,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
565565
np->dontfrag);
566566

567567
if (err) {
568-
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
568+
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
569569
ip6_flush_pending_frames(sk);
570570
goto out_put;
571571
}

0 commit comments

Comments
 (0)