diff options
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r-- | drivers/net/cxgb3/common.h | 28 | ||||
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 10 | ||||
-rw-r--r-- | drivers/net/cxgb3/cxgb3_offload.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 16 | ||||
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 3 | ||||
-rw-r--r-- | drivers/net/cxgb3/xgmac.c | 18 |
6 files changed, 30 insertions, 47 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h index 6ff356d4c7ab..fe08a004b0dd 100644 --- a/drivers/net/cxgb3/common.h +++ b/drivers/net/cxgb3/common.h | |||
@@ -67,32 +67,6 @@ | |||
67 | /* Additional NETIF_MSG_* categories */ | 67 | /* Additional NETIF_MSG_* categories */ |
68 | #define NETIF_MSG_MMIO 0x8000000 | 68 | #define NETIF_MSG_MMIO 0x8000000 |
69 | 69 | ||
70 | struct t3_rx_mode { | ||
71 | struct net_device *dev; | ||
72 | struct dev_mc_list *mclist; | ||
73 | unsigned int idx; | ||
74 | }; | ||
75 | |||
76 | static inline void init_rx_mode(struct t3_rx_mode *p, struct net_device *dev, | ||
77 | struct dev_mc_list *mclist) | ||
78 | { | ||
79 | p->dev = dev; | ||
80 | p->mclist = mclist; | ||
81 | p->idx = 0; | ||
82 | } | ||
83 | |||
84 | static inline u8 *t3_get_next_mcaddr(struct t3_rx_mode *rm) | ||
85 | { | ||
86 | u8 *addr = NULL; | ||
87 | |||
88 | if (rm->mclist && rm->idx < rm->dev->mc_count) { | ||
89 | addr = rm->mclist->dmi_addr; | ||
90 | rm->mclist = rm->mclist->next; | ||
91 | rm->idx++; | ||
92 | } | ||
93 | return addr; | ||
94 | } | ||
95 | |||
96 | enum { | 70 | enum { |
97 | MAX_NPORTS = 2, /* max # of ports */ | 71 | MAX_NPORTS = 2, /* max # of ports */ |
98 | MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ | 72 | MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ |
@@ -746,7 +720,7 @@ void t3_mac_enable_exact_filters(struct cmac *mac); | |||
746 | int t3_mac_enable(struct cmac *mac, int which); | 720 | int t3_mac_enable(struct cmac *mac, int which); |
747 | int t3_mac_disable(struct cmac *mac, int which); | 721 | int t3_mac_disable(struct cmac *mac, int which); |
748 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); | 722 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); |
749 | int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm); | 723 | int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev); |
750 | int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); | 724 | int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); |
751 | int t3_mac_set_num_ucast(struct cmac *mac, int n); | 725 | int t3_mac_set_num_ucast(struct cmac *mac, int n); |
752 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); | 726 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 37945fce7fa5..3e453e1d97e7 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -81,7 +81,7 @@ enum { | |||
81 | #define CH_DEVICE(devid, idx) \ | 81 | #define CH_DEVICE(devid, idx) \ |
82 | { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, PCI_ANY_ID, 0, 0, idx } | 82 | { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, PCI_ANY_ID, 0, 0, idx } |
83 | 83 | ||
84 | static const struct pci_device_id cxgb3_pci_tbl[] = { | 84 | static DEFINE_PCI_DEVICE_TABLE(cxgb3_pci_tbl) = { |
85 | CH_DEVICE(0x20, 0), /* PE9000 */ | 85 | CH_DEVICE(0x20, 0), /* PE9000 */ |
86 | CH_DEVICE(0x21, 1), /* T302E */ | 86 | CH_DEVICE(0x21, 1), /* T302E */ |
87 | CH_DEVICE(0x22, 2), /* T310E */ | 87 | CH_DEVICE(0x22, 2), /* T310E */ |
@@ -325,11 +325,9 @@ void t3_os_phymod_changed(struct adapter *adap, int port_id) | |||
325 | 325 | ||
326 | static void cxgb_set_rxmode(struct net_device *dev) | 326 | static void cxgb_set_rxmode(struct net_device *dev) |
327 | { | 327 | { |
328 | struct t3_rx_mode rm; | ||
329 | struct port_info *pi = netdev_priv(dev); | 328 | struct port_info *pi = netdev_priv(dev); |
330 | 329 | ||
331 | init_rx_mode(&rm, dev, dev->mc_list); | 330 | t3_mac_set_rx_mode(&pi->mac, dev); |
332 | t3_mac_set_rx_mode(&pi->mac, &rm); | ||
333 | } | 331 | } |
334 | 332 | ||
335 | /** | 333 | /** |
@@ -340,17 +338,15 @@ static void cxgb_set_rxmode(struct net_device *dev) | |||
340 | */ | 338 | */ |
341 | static void link_start(struct net_device *dev) | 339 | static void link_start(struct net_device *dev) |
342 | { | 340 | { |
343 | struct t3_rx_mode rm; | ||
344 | struct port_info *pi = netdev_priv(dev); | 341 | struct port_info *pi = netdev_priv(dev); |
345 | struct cmac *mac = &pi->mac; | 342 | struct cmac *mac = &pi->mac; |
346 | 343 | ||
347 | init_rx_mode(&rm, dev, dev->mc_list); | ||
348 | t3_mac_reset(mac); | 344 | t3_mac_reset(mac); |
349 | t3_mac_set_num_ucast(mac, MAX_MAC_IDX); | 345 | t3_mac_set_num_ucast(mac, MAX_MAC_IDX); |
350 | t3_mac_set_mtu(mac, dev->mtu); | 346 | t3_mac_set_mtu(mac, dev->mtu); |
351 | t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr); | 347 | t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr); |
352 | t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr); | 348 | t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr); |
353 | t3_mac_set_rx_mode(mac, &rm); | 349 | t3_mac_set_rx_mode(mac, dev); |
354 | t3_link_start(&pi->phy, mac, &pi->link_config); | 350 | t3_link_start(&pi->phy, mac, &pi->link_config); |
355 | t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); | 351 | t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); |
356 | } | 352 | } |
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c index 75064eea1d87..9498361119d6 100644 --- a/drivers/net/cxgb3/cxgb3_offload.c +++ b/drivers/net/cxgb3/cxgb3_offload.c | |||
@@ -1252,7 +1252,7 @@ int cxgb3_offload_activate(struct adapter *adapter) | |||
1252 | struct mtutab mtutab; | 1252 | struct mtutab mtutab; |
1253 | unsigned int l2t_capacity; | 1253 | unsigned int l2t_capacity; |
1254 | 1254 | ||
1255 | t = kcalloc(1, sizeof(*t), GFP_KERNEL); | 1255 | t = kzalloc(sizeof(*t), GFP_KERNEL); |
1256 | if (!t) | 1256 | if (!t) |
1257 | return -ENOMEM; | 1257 | return -ENOMEM; |
1258 | 1258 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 9b434461c4f1..78e265b484b6 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -481,6 +481,7 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) | |||
481 | { | 481 | { |
482 | if (q->pend_cred >= q->credits / 4) { | 482 | if (q->pend_cred >= q->credits / 4) { |
483 | q->pend_cred = 0; | 483 | q->pend_cred = 0; |
484 | wmb(); | ||
484 | t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); | 485 | t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); |
485 | } | 486 | } |
486 | } | 487 | } |
@@ -2287,11 +2288,14 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs, | |||
2287 | while (likely(budget_left && is_new_response(r, q))) { | 2288 | while (likely(budget_left && is_new_response(r, q))) { |
2288 | int packet_complete, eth, ethpad = 2, lro = qs->lro_enabled; | 2289 | int packet_complete, eth, ethpad = 2, lro = qs->lro_enabled; |
2289 | struct sk_buff *skb = NULL; | 2290 | struct sk_buff *skb = NULL; |
2290 | u32 len, flags = ntohl(r->flags); | 2291 | u32 len, flags; |
2291 | __be32 rss_hi = *(const __be32 *)r, | 2292 | __be32 rss_hi, rss_lo; |
2292 | rss_lo = r->rss_hdr.rss_hash_val; | ||
2293 | 2293 | ||
2294 | rmb(); | ||
2294 | eth = r->rss_hdr.opcode == CPL_RX_PKT; | 2295 | eth = r->rss_hdr.opcode == CPL_RX_PKT; |
2296 | rss_hi = *(const __be32 *)r; | ||
2297 | rss_lo = r->rss_hdr.rss_hash_val; | ||
2298 | flags = ntohl(r->flags); | ||
2295 | 2299 | ||
2296 | if (unlikely(flags & F_RSPD_ASYNC_NOTIF)) { | 2300 | if (unlikely(flags & F_RSPD_ASYNC_NOTIF)) { |
2297 | skb = alloc_skb(AN_PKT_SIZE, GFP_ATOMIC); | 2301 | skb = alloc_skb(AN_PKT_SIZE, GFP_ATOMIC); |
@@ -2502,7 +2506,10 @@ static int process_pure_responses(struct adapter *adap, struct sge_qset *qs, | |||
2502 | refill_rspq(adap, q, q->credits); | 2506 | refill_rspq(adap, q, q->credits); |
2503 | q->credits = 0; | 2507 | q->credits = 0; |
2504 | } | 2508 | } |
2505 | } while (is_new_response(r, q) && is_pure_response(r)); | 2509 | if (!is_new_response(r, q)) |
2510 | break; | ||
2511 | rmb(); | ||
2512 | } while (is_pure_response(r)); | ||
2506 | 2513 | ||
2507 | if (sleeping) | 2514 | if (sleeping) |
2508 | check_ring_db(adap, qs, sleeping); | 2515 | check_ring_db(adap, qs, sleeping); |
@@ -2536,6 +2543,7 @@ static inline int handle_responses(struct adapter *adap, struct sge_rspq *q) | |||
2536 | 2543 | ||
2537 | if (!is_new_response(r, q)) | 2544 | if (!is_new_response(r, q)) |
2538 | return -1; | 2545 | return -1; |
2546 | rmb(); | ||
2539 | if (is_pure_response(r) && process_pure_responses(adap, qs, r) == 0) { | 2547 | if (is_pure_response(r) && process_pure_responses(adap, qs, r) == 0) { |
2540 | t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | | 2548 | t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | |
2541 | V_NEWTIMER(q->holdoff_tmr) | V_NEWINDEX(q->cidx)); | 2549 | V_NEWTIMER(q->holdoff_tmr) | V_NEWINDEX(q->cidx)); |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index c38fc717a0d1..95a8ba0759f1 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1262,7 +1262,8 @@ void t3_link_changed(struct adapter *adapter, int port_id) | |||
1262 | lc->fc = fc; | 1262 | lc->fc = fc; |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | t3_os_link_changed(adapter, port_id, link_ok, speed, duplex, fc); | 1265 | t3_os_link_changed(adapter, port_id, link_ok && !pi->link_fault, |
1266 | speed, duplex, fc); | ||
1266 | } | 1267 | } |
1267 | 1268 | ||
1268 | void t3_link_fault(struct adapter *adapter, int port_id) | 1269 | void t3_link_fault(struct adapter *adapter, int port_id) |
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index 0109ee4f2f91..c142a2132e9f 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
@@ -297,29 +297,30 @@ static int hash_hw_addr(const u8 * addr) | |||
297 | return hash; | 297 | return hash; |
298 | } | 298 | } |
299 | 299 | ||
300 | int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm) | 300 | int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev) |
301 | { | 301 | { |
302 | u32 val, hash_lo, hash_hi; | 302 | u32 val, hash_lo, hash_hi; |
303 | struct adapter *adap = mac->adapter; | 303 | struct adapter *adap = mac->adapter; |
304 | unsigned int oft = mac->offset; | 304 | unsigned int oft = mac->offset; |
305 | 305 | ||
306 | val = t3_read_reg(adap, A_XGM_RX_CFG + oft) & ~F_COPYALLFRAMES; | 306 | val = t3_read_reg(adap, A_XGM_RX_CFG + oft) & ~F_COPYALLFRAMES; |
307 | if (rm->dev->flags & IFF_PROMISC) | 307 | if (dev->flags & IFF_PROMISC) |
308 | val |= F_COPYALLFRAMES; | 308 | val |= F_COPYALLFRAMES; |
309 | t3_write_reg(adap, A_XGM_RX_CFG + oft, val); | 309 | t3_write_reg(adap, A_XGM_RX_CFG + oft, val); |
310 | 310 | ||
311 | if (rm->dev->flags & IFF_ALLMULTI) | 311 | if (dev->flags & IFF_ALLMULTI) |
312 | hash_lo = hash_hi = 0xffffffff; | 312 | hash_lo = hash_hi = 0xffffffff; |
313 | else { | 313 | else { |
314 | u8 *addr; | 314 | struct dev_mc_list *dmi; |
315 | int exact_addr_idx = mac->nucast; | 315 | int exact_addr_idx = mac->nucast; |
316 | 316 | ||
317 | hash_lo = hash_hi = 0; | 317 | hash_lo = hash_hi = 0; |
318 | while ((addr = t3_get_next_mcaddr(rm))) | 318 | netdev_for_each_mc_addr(dmi, dev) |
319 | if (exact_addr_idx < EXACT_ADDR_FILTERS) | 319 | if (exact_addr_idx < EXACT_ADDR_FILTERS) |
320 | set_addr_filter(mac, exact_addr_idx++, addr); | 320 | set_addr_filter(mac, exact_addr_idx++, |
321 | dmi->dmi_addr); | ||
321 | else { | 322 | else { |
322 | int hash = hash_hw_addr(addr); | 323 | int hash = hash_hw_addr(dmi->dmi_addr); |
323 | 324 | ||
324 | if (hash < 32) | 325 | if (hash < 32) |
325 | hash_lo |= (1 << hash); | 326 | hash_lo |= (1 << hash); |
@@ -353,6 +354,9 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
353 | * packet size register includes header, but not FCS. | 354 | * packet size register includes header, but not FCS. |
354 | */ | 355 | */ |
355 | mtu += 14; | 356 | mtu += 14; |
357 | if (mtu > 1536) | ||
358 | mtu += 4; | ||
359 | |||
356 | if (mtu > MAX_FRAME_SIZE - 4) | 360 | if (mtu > MAX_FRAME_SIZE - 4) |
357 | return -EINVAL; | 361 | return -EINVAL; |
358 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); | 362 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); |