diff options
Diffstat (limited to 'drivers/net/wimax/i2400m/i2400m.h')
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m.h | 82 |
1 files changed, 73 insertions, 9 deletions
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index 820b128705ec..fa74777fd65f 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h | |||
@@ -160,6 +160,16 @@ | |||
160 | #include <linux/wimax/i2400m.h> | 160 | #include <linux/wimax/i2400m.h> |
161 | #include <asm/byteorder.h> | 161 | #include <asm/byteorder.h> |
162 | 162 | ||
163 | enum { | ||
164 | /* netdev interface */ | ||
165 | /* | ||
166 | * Out of NWG spec (R1_v1.2.2), 3.3.3 ASN Bearer Plane MTU Size | ||
167 | * | ||
168 | * The MTU is 1400 or less | ||
169 | */ | ||
170 | I2400M_MAX_MTU = 1400, | ||
171 | }; | ||
172 | |||
163 | /* Misc constants */ | 173 | /* Misc constants */ |
164 | enum { | 174 | enum { |
165 | /* Size of the Boot Mode Command buffer */ | 175 | /* Size of the Boot Mode Command buffer */ |
@@ -167,6 +177,11 @@ enum { | |||
167 | I2400M_BM_ACK_BUF_SIZE = 256, | 177 | I2400M_BM_ACK_BUF_SIZE = 256, |
168 | }; | 178 | }; |
169 | 179 | ||
180 | enum { | ||
181 | /* Maximum number of bus reset can be retried */ | ||
182 | I2400M_BUS_RESET_RETRIES = 3, | ||
183 | }; | ||
184 | |||
170 | /** | 185 | /** |
171 | * struct i2400m_poke_table - Hardware poke table for the Intel 2400m | 186 | * struct i2400m_poke_table - Hardware poke table for the Intel 2400m |
172 | * | 187 | * |
@@ -227,6 +242,11 @@ struct i2400m_barker_db; | |||
227 | * so we have a tx_blk_size variable that the bus layer sets to | 242 | * so we have a tx_blk_size variable that the bus layer sets to |
228 | * tell the engine how much of that we need. | 243 | * tell the engine how much of that we need. |
229 | * | 244 | * |
245 | * @bus_tx_room_min: [fill] Minimum room required while allocating | ||
246 | * TX queue's buffer space for message header. SDIO requires | ||
247 | * 224 bytes and USB 16 bytes. Refer bus specific driver code | ||
248 | * for details. | ||
249 | * | ||
230 | * @bus_pl_size_max: [fill] Maximum payload size. | 250 | * @bus_pl_size_max: [fill] Maximum payload size. |
231 | * | 251 | * |
232 | * @bus_setup: [optional fill] Function called by the bus-generic code | 252 | * @bus_setup: [optional fill] Function called by the bus-generic code |
@@ -397,7 +417,7 @@ struct i2400m_barker_db; | |||
397 | * | 417 | * |
398 | * @tx_size_max: biggest TX message sent. | 418 | * @tx_size_max: biggest TX message sent. |
399 | * | 419 | * |
400 | * @rx_lock: spinlock to protect RX members | 420 | * @rx_lock: spinlock to protect RX members and rx_roq_refcount. |
401 | * | 421 | * |
402 | * @rx_pl_num: total number of payloads received | 422 | * @rx_pl_num: total number of payloads received |
403 | * | 423 | * |
@@ -421,6 +441,10 @@ struct i2400m_barker_db; | |||
421 | * delivered. Then the driver can release them to the host. See | 441 | * delivered. Then the driver can release them to the host. See |
422 | * drivers/net/i2400m/rx.c for details. | 442 | * drivers/net/i2400m/rx.c for details. |
423 | * | 443 | * |
444 | * @rx_roq_refcount: refcount rx_roq. This refcounts any access to | ||
445 | * rx_roq thus preventing rx_roq being destroyed when rx_roq | ||
446 | * is being accessed. rx_roq_refcount is protected by rx_lock. | ||
447 | * | ||
424 | * @rx_reports: reports received from the device that couldn't be | 448 | * @rx_reports: reports received from the device that couldn't be |
425 | * processed because the driver wasn't still ready; when ready, | 449 | * processed because the driver wasn't still ready; when ready, |
426 | * they are pulled from here and chewed. | 450 | * they are pulled from here and chewed. |
@@ -507,6 +531,38 @@ struct i2400m_barker_db; | |||
507 | * same. | 531 | * same. |
508 | * | 532 | * |
509 | * @pm_notifier: used to register for PM events | 533 | * @pm_notifier: used to register for PM events |
534 | * | ||
535 | * @bus_reset_retries: counter for the number of bus resets attempted for | ||
536 | * this boot. It's not for tracking the number of bus resets during | ||
537 | * the whole driver life cycle (from insmod to rmmod) but for the | ||
538 | * number of dev_start() executed until dev_start() returns a success | ||
539 | * (ie: a good boot means a dev_stop() followed by a successful | ||
540 | * dev_start()). dev_reset_handler() increments this counter whenever | ||
541 | * it is triggering a bus reset. It checks this counter to decide if a | ||
542 | * subsequent bus reset should be retried. dev_reset_handler() retries | ||
543 | * the bus reset until dev_start() succeeds or the counter reaches | ||
544 | * I2400M_BUS_RESET_RETRIES. The counter is cleared to 0 in | ||
545 | * dev_reset_handle() when dev_start() returns a success, | ||
546 | * ie: a successul boot is completed. | ||
547 | * | ||
548 | * @alive: flag to denote if the device *should* be alive. This flag is | ||
549 | * everything like @updown (see doc for @updown) except reflecting | ||
550 | * the device state *we expect* rather than the actual state as denoted | ||
551 | * by @updown. It is set 1 whenever @updown is set 1 in dev_start(). | ||
552 | * Then the device is expected to be alive all the time | ||
553 | * (i2400m->alive remains 1) until the driver is removed. Therefore | ||
554 | * all the device reboot events detected can be still handled properly | ||
555 | * by either dev_reset_handle() or .pre_reset/.post_reset as long as | ||
556 | * the driver presents. It is set 0 along with @updown in dev_stop(). | ||
557 | * | ||
558 | * @error_recovery: flag to denote if we are ready to take an error recovery. | ||
559 | * 0 for ready to take an error recovery; 1 for not ready. It is | ||
560 | * initialized to 1 while probe() since we don't tend to take any error | ||
561 | * recovery during probe(). It is decremented by 1 whenever dev_start() | ||
562 | * succeeds to indicate we are ready to take error recovery from now on. | ||
563 | * It is checked every time we wanna schedule an error recovery. If an | ||
564 | * error recovery is already in place (error_recovery was set 1), we | ||
565 | * should not schedule another one until the last one is done. | ||
510 | */ | 566 | */ |
511 | struct i2400m { | 567 | struct i2400m { |
512 | struct wimax_dev wimax_dev; /* FIRST! See doc */ | 568 | struct wimax_dev wimax_dev; /* FIRST! See doc */ |
@@ -522,6 +578,7 @@ struct i2400m { | |||
522 | wait_queue_head_t state_wq; /* Woken up when on state updates */ | 578 | wait_queue_head_t state_wq; /* Woken up when on state updates */ |
523 | 579 | ||
524 | size_t bus_tx_block_size; | 580 | size_t bus_tx_block_size; |
581 | size_t bus_tx_room_min; | ||
525 | size_t bus_pl_size_max; | 582 | size_t bus_pl_size_max; |
526 | unsigned bus_bm_retries; | 583 | unsigned bus_bm_retries; |
527 | 584 | ||
@@ -550,10 +607,12 @@ struct i2400m { | |||
550 | tx_num, tx_size_acc, tx_size_min, tx_size_max; | 607 | tx_num, tx_size_acc, tx_size_min, tx_size_max; |
551 | 608 | ||
552 | /* RX stuff */ | 609 | /* RX stuff */ |
553 | spinlock_t rx_lock; /* protect RX state */ | 610 | /* protect RX state and rx_roq_refcount */ |
611 | spinlock_t rx_lock; | ||
554 | unsigned rx_pl_num, rx_pl_max, rx_pl_min, | 612 | unsigned rx_pl_num, rx_pl_max, rx_pl_min, |
555 | rx_num, rx_size_acc, rx_size_min, rx_size_max; | 613 | rx_num, rx_size_acc, rx_size_min, rx_size_max; |
556 | struct i2400m_roq *rx_roq; /* not under rx_lock! */ | 614 | struct i2400m_roq *rx_roq; /* access is refcounted */ |
615 | struct kref rx_roq_refcount; /* refcount access to rx_roq */ | ||
557 | u8 src_mac_addr[ETH_HLEN]; | 616 | u8 src_mac_addr[ETH_HLEN]; |
558 | struct list_head rx_reports; /* under rx_lock! */ | 617 | struct list_head rx_reports; /* under rx_lock! */ |
559 | struct work_struct rx_report_ws; | 618 | struct work_struct rx_report_ws; |
@@ -581,6 +640,16 @@ struct i2400m { | |||
581 | struct i2400m_barker_db *barker; | 640 | struct i2400m_barker_db *barker; |
582 | 641 | ||
583 | struct notifier_block pm_notifier; | 642 | struct notifier_block pm_notifier; |
643 | |||
644 | /* counting bus reset retries in this boot */ | ||
645 | atomic_t bus_reset_retries; | ||
646 | |||
647 | /* if the device is expected to be alive */ | ||
648 | unsigned alive; | ||
649 | |||
650 | /* 0 if we are ready for error recovery; 1 if not ready */ | ||
651 | atomic_t error_recovery; | ||
652 | |||
584 | }; | 653 | }; |
585 | 654 | ||
586 | 655 | ||
@@ -803,6 +872,7 @@ void i2400m_put(struct i2400m *i2400m) | |||
803 | extern int i2400m_dev_reset_handle(struct i2400m *, const char *); | 872 | extern int i2400m_dev_reset_handle(struct i2400m *, const char *); |
804 | extern int i2400m_pre_reset(struct i2400m *); | 873 | extern int i2400m_pre_reset(struct i2400m *); |
805 | extern int i2400m_post_reset(struct i2400m *); | 874 | extern int i2400m_post_reset(struct i2400m *); |
875 | extern void i2400m_error_recovery(struct i2400m *); | ||
806 | 876 | ||
807 | /* | 877 | /* |
808 | * _setup()/_release() are called by the probe/disconnect functions of | 878 | * _setup()/_release() are called by the probe/disconnect functions of |
@@ -815,7 +885,6 @@ extern int i2400m_rx(struct i2400m *, struct sk_buff *); | |||
815 | extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); | 885 | extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); |
816 | extern void i2400m_tx_msg_sent(struct i2400m *); | 886 | extern void i2400m_tx_msg_sent(struct i2400m *); |
817 | 887 | ||
818 | extern int i2400m_power_save_disabled; | ||
819 | 888 | ||
820 | /* | 889 | /* |
821 | * Utility functions | 890 | * Utility functions |
@@ -922,10 +991,5 @@ extern int i2400m_barker_db_init(const char *); | |||
922 | extern void i2400m_barker_db_exit(void); | 991 | extern void i2400m_barker_db_exit(void); |
923 | 992 | ||
924 | 993 | ||
925 | /* Module parameters */ | ||
926 | |||
927 | extern int i2400m_idle_mode_disabled; | ||
928 | extern int i2400m_rx_reorder_disabled; | ||
929 | |||
930 | 994 | ||
931 | #endif /* #ifndef __I2400M_H__ */ | 995 | #endif /* #ifndef __I2400M_H__ */ |