aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_cmn.h
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2010-10-05 23:34:21 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-06 17:10:41 -0400
commitf85582f8c48addd8166727ef692d88b0ff618c5e (patch)
tree5ea8ef71ae9ca5e67793350b3533f146116bd177 /drivers/net/bnx2x/bnx2x_cmn.h
parentc2bff63fad94eeecf59e4ba8e4cb51688ccae1ec (diff)
bnx2x: code beautify
This patch does not include any functional changes. The changes are: empty lines, indentation and comments. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.h')
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.h145
1 files changed, 106 insertions, 39 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
index 1d9686ea6b6..7f52cec9bb9 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/bnx2x/bnx2x_cmn.h
@@ -64,6 +64,15 @@ u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes);
64void bnx2x__link_status_update(struct bnx2x *bp); 64void bnx2x__link_status_update(struct bnx2x *bp);
65 65
66/** 66/**
67 * Report link status to upper layer
68 *
69 * @param bp
70 *
71 * @return int
72 */
73void bnx2x_link_report(struct bnx2x *bp);
74
75/**
67 * MSI-X slowpath interrupt handler 76 * MSI-X slowpath interrupt handler
68 * 77 *
69 * @param irq 78 * @param irq
@@ -234,7 +243,7 @@ int bnx2x_release_hw_lock(struct bnx2x *bp, u32 resource);
234 243
235/** 244/**
236 * Configure eth MAC address in the HW according to the value in 245 * Configure eth MAC address in the HW according to the value in
237 * netdev->dev_addr for 57711 246 * netdev->dev_addr.
238 * 247 *
239 * @param bp driver handle 248 * @param bp driver handle
240 * @param set 249 * @param set
@@ -270,10 +279,11 @@ void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid,
270 u8 vf_valid, int fw_sb_id, int igu_sb_id); 279 u8 vf_valid, int fw_sb_id, int igu_sb_id);
271 280
272/** 281/**
273 * Reconfigure FW/HW according to dev->flags rx mode 282 * Set MAC filtering configurations.
274 * 283 *
275 * @param dev net_device 284 * @remarks called with netif_tx_lock from dev_mcast.c
276 * 285 *
286 * @param dev net_device
277 */ 287 */
278void bnx2x_set_rx_mode(struct net_device *dev); 288void bnx2x_set_rx_mode(struct net_device *dev);
279 289
@@ -295,17 +305,17 @@ void bnx2x_disable_close_the_gate(struct bnx2x *bp);
295 * Perform statistics handling according to event 305 * Perform statistics handling according to event
296 * 306 *
297 * @param bp driver handle 307 * @param bp driver handle
298 * @param even tbnx2x_stats_event 308 * @param event bnx2x_stats_event
299 */ 309 */
300void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event); 310void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event);
301 311
302/** 312/**
303 * Handle sp events 313 * Handle ramrods completion
304 * 314 *
305 * @param fp fastpath handle for the event 315 * @param fp fastpath handle for the event
306 * @param rr_cqe eth_rx_cqe 316 * @param rr_cqe eth_rx_cqe
307 */ 317 */
308void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe); 318void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe);
309 319
310/** 320/**
311 * Init/halt function before/after sending 321 * Init/halt function before/after sending
@@ -327,6 +337,46 @@ int bnx2x_func_stop(struct bnx2x *bp);
327void bnx2x_ilt_set_info(struct bnx2x *bp); 337void bnx2x_ilt_set_info(struct bnx2x *bp);
328 338
329/** 339/**
340 * Set power state to the requested value. Currently only D0 and
341 * D3hot are supported.
342 *
343 * @param bp
344 * @param state D0 or D3hot
345 *
346 * @return int
347 */
348int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state);
349
350/* dev_close main block */
351int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);
352
353/* dev_open main block */
354int bnx2x_nic_load(struct bnx2x *bp, int load_mode);
355
356/* hard_xmit callback */
357netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev);
358
359int bnx2x_change_mac_addr(struct net_device *dev, void *p);
360
361/* NAPI poll Rx part */
362int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget);
363
364/* NAPI poll Tx part */
365int bnx2x_tx_int(struct bnx2x_fastpath *fp);
366
367/* suspend/resume callbacks */
368int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state);
369int bnx2x_resume(struct pci_dev *pdev);
370
371/* Release IRQ vectors */
372void bnx2x_free_irq(struct bnx2x *bp);
373
374void bnx2x_init_rx_rings(struct bnx2x *bp);
375void bnx2x_free_skbs(struct bnx2x *bp);
376void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw);
377void bnx2x_netif_start(struct bnx2x *bp);
378
379/**
330 * Fill msix_table, request vectors, update num_queues according 380 * Fill msix_table, request vectors, update num_queues according
331 * to number of available vectors 381 * to number of available vectors
332 * 382 *
@@ -362,6 +412,51 @@ int bnx2x_setup_irqs(struct bnx2x *bp);
362 * @return int 412 * @return int
363 */ 413 */
364int bnx2x_poll(struct napi_struct *napi, int budget); 414int bnx2x_poll(struct napi_struct *napi, int budget);
415
416/**
417 * Allocate/release memories outsize main driver structure
418 *
419 * @param bp
420 *
421 * @return int
422 */
423int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp);
424void bnx2x_free_mem_bp(struct bnx2x *bp);
425
426/**
427 * Change mtu netdev callback
428 *
429 * @param dev
430 * @param new_mtu
431 *
432 * @return int
433 */
434int bnx2x_change_mtu(struct net_device *dev, int new_mtu);
435
436/**
437 * tx timeout netdev callback
438 *
439 * @param dev
440 * @param new_mtu
441 *
442 * @return int
443 */
444void bnx2x_tx_timeout(struct net_device *dev);
445
446#ifdef BCM_VLAN
447/**
448 * vlan rx register netdev callback
449 *
450 * @param dev
451 * @param new_mtu
452 *
453 * @return int
454 */
455void bnx2x_vlan_rx_register(struct net_device *dev,
456 struct vlan_group *vlgrp);
457
458#endif
459
365static inline void bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp) 460static inline void bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp)
366{ 461{
367 barrier(); /* status block is written to by the chip */ 462 barrier(); /* status block is written to by the chip */
@@ -558,9 +653,6 @@ static inline u16 bnx2x_ack_int(struct bnx2x *bp)
558 return bnx2x_igu_ack_int(bp); 653 return bnx2x_igu_ack_int(bp);
559} 654}
560 655
561/*
562 * fast path service functions
563 */
564static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp) 656static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp)
565{ 657{
566 /* Tell compiler that consumer and producer can change */ 658 /* Tell compiler that consumer and producer can change */
@@ -611,6 +703,7 @@ static inline int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
611 rx_cons_sb++; 703 rx_cons_sb++;
612 return (fp->rx_comp_cons != rx_cons_sb); 704 return (fp->rx_comp_cons != rx_cons_sb);
613} 705}
706
614/** 707/**
615 * disables tx from stack point of view 708 * disables tx from stack point of view
616 * 709 *
@@ -731,6 +824,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp,
731 824
732 return 0; 825 return 0;
733} 826}
827
734static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp, 828static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
735 struct bnx2x_fastpath *fp, u16 index) 829 struct bnx2x_fastpath *fp, u16 index)
736{ 830{
@@ -782,6 +876,7 @@ static inline void bnx2x_reuse_rx_skb(struct bnx2x_fastpath *fp,
782 dma_unmap_addr(cons_rx_buf, mapping)); 876 dma_unmap_addr(cons_rx_buf, mapping));
783 *prod_bd = *cons_bd; 877 *prod_bd = *cons_bd;
784} 878}
879
785static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp, 880static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp,
786 struct bnx2x_fastpath *fp, int last) 881 struct bnx2x_fastpath *fp, int last)
787{ 882{
@@ -846,6 +941,7 @@ static inline void bnx2x_init_tx_rings(struct bnx2x *bp)
846 fp->tx_pkt = 0; 941 fp->tx_pkt = 0;
847 } 942 }
848} 943}
944
849static inline void bnx2x_set_next_page_rx_bd(struct bnx2x_fastpath *fp) 945static inline void bnx2x_set_next_page_rx_bd(struct bnx2x_fastpath *fp)
850{ 946{
851 int i; 947 int i;
@@ -931,40 +1027,11 @@ static inline void storm_memset_cmng(struct bnx2x *bp,
931 1027
932 __storm_memset_struct(bp, addr, size, (u32 *)cmng); 1028 __storm_memset_struct(bp, addr, size, (u32 *)cmng);
933} 1029}
1030
934/* HW Lock for shared dual port PHYs */ 1031/* HW Lock for shared dual port PHYs */
935void bnx2x_acquire_phy_lock(struct bnx2x *bp); 1032void bnx2x_acquire_phy_lock(struct bnx2x *bp);
936void bnx2x_release_phy_lock(struct bnx2x *bp); 1033void bnx2x_release_phy_lock(struct bnx2x *bp);
937 1034
938void bnx2x_link_report(struct bnx2x *bp);
939int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget);
940int bnx2x_tx_int(struct bnx2x_fastpath *fp);
941void bnx2x_init_rx_rings(struct bnx2x *bp);
942netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev);
943
944int bnx2x_change_mac_addr(struct net_device *dev, void *p);
945void bnx2x_tx_timeout(struct net_device *dev);
946void bnx2x_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp);
947void bnx2x_netif_start(struct bnx2x *bp);
948void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw);
949void bnx2x_free_irq(struct bnx2x *bp);
950int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state);
951int bnx2x_resume(struct pci_dev *pdev);
952void bnx2x_free_skbs(struct bnx2x *bp);
953int bnx2x_change_mtu(struct net_device *dev, int new_mtu);
954int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);
955int bnx2x_nic_load(struct bnx2x *bp, int load_mode);
956int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state);
957
958/**
959 * Allocate/release memories outsize main driver structure
960 *
961 * @param bp
962 *
963 * @return int
964 */
965int __devinit bnx2x_alloc_mem_bp(struct bnx2x *bp);
966void bnx2x_free_mem_bp(struct bnx2x *bp);
967
968#define BNX2X_FW_IP_HDR_ALIGN_PAD 2 /* FW places hdr with this padding */ 1035#define BNX2X_FW_IP_HDR_ALIGN_PAD 2 /* FW places hdr with this padding */
969 1036
970#endif /* BNX2X_CMN_H */ 1037#endif /* BNX2X_CMN_H */