Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / net / ncsi / internal.h
index 33738c0..1308a56 100644 (file)
@@ -170,6 +170,7 @@ struct ncsi_package;
 
 #define NCSI_PACKAGE_SHIFT     5
 #define NCSI_PACKAGE_INDEX(c)  (((c) >> NCSI_PACKAGE_SHIFT) & 0x7)
+#define NCSI_RESERVED_CHANNEL  0x1f
 #define NCSI_CHANNEL_INDEX(c)  ((c) & ((1 << NCSI_PACKAGE_SHIFT) - 1))
 #define NCSI_TO_CHANNEL(p, c)  (((p) << NCSI_PACKAGE_SHIFT) | (c))
 
@@ -186,9 +187,15 @@ struct ncsi_channel {
        struct ncsi_channel_mode    modes[NCSI_MODE_MAX];
        struct ncsi_channel_filter  *filters[NCSI_FILTER_MAX];
        struct ncsi_channel_stats   stats;
-       struct timer_list           timer;      /* Link monitor timer  */
-       bool                        enabled;    /* Timer is enabled    */
-       unsigned int                timeout;    /* Times of timeout    */
+       struct {
+               struct timer_list   timer;
+               bool                enabled;
+               unsigned int        state;
+#define NCSI_CHANNEL_MONITOR_START     0
+#define NCSI_CHANNEL_MONITOR_RETRY     1
+#define NCSI_CHANNEL_MONITOR_WAIT      2
+#define NCSI_CHANNEL_MONITOR_WAIT_MAX  5
+       } monitor;
        struct list_head            node;
        struct list_head            link;
 };
@@ -206,7 +213,8 @@ struct ncsi_package {
 struct ncsi_request {
        unsigned char        id;      /* Request ID - 0 to 255           */
        bool                 used;    /* Request that has been assigned  */
-       bool                 driven;  /* Drive state machine             */
+       unsigned int         flags;   /* NCSI request property           */
+#define NCSI_REQ_FLAG_EVENT_DRIVEN     1
        struct ncsi_dev_priv *ndp;    /* Associated NCSI device          */
        struct sk_buff       *cmd;    /* Associated NCSI command packet  */
        struct sk_buff       *rsp;    /* Associated NCSI response packet */
@@ -238,6 +246,7 @@ enum {
        ncsi_dev_state_config_gls,
        ncsi_dev_state_config_done,
        ncsi_dev_state_suspend_select   = 0x0401,
+       ncsi_dev_state_suspend_gls,
        ncsi_dev_state_suspend_dcnt,
        ncsi_dev_state_suspend_dc,
        ncsi_dev_state_suspend_deselect,
@@ -256,8 +265,10 @@ struct ncsi_dev_priv {
 #endif
        unsigned int        package_num;     /* Number of packages         */
        struct list_head    packages;        /* List of packages           */
+       struct ncsi_channel *hot_channel;    /* Channel was ever active    */
        struct ncsi_request requests[256];   /* Request table              */
        unsigned int        request_id;      /* Last used request ID       */
+#define NCSI_REQ_START_IDX     1
        unsigned int        pending_req_num; /* Number of pending requests */
        struct ncsi_package *active_package; /* Currently handled package  */
        struct ncsi_channel *active_channel; /* Currently handled channel  */
@@ -274,7 +285,7 @@ struct ncsi_cmd_arg {
        unsigned char        package;     /* Destination package ID        */
        unsigned char        channel;     /* Detination channel ID or 0x1f */
        unsigned short       payload;     /* Command packet payload length */
-       bool                 driven;      /* Drive the state machine?      */
+       unsigned int         req_flags;   /* NCSI request properties       */
        union {
                unsigned char  bytes[16]; /* Command packet specific data  */
                unsigned short words[8];
@@ -313,7 +324,8 @@ void ncsi_find_package_and_channel(struct ncsi_dev_priv *ndp,
                                   unsigned char id,
                                   struct ncsi_package **np,
                                   struct ncsi_channel **nc);
-struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp, bool driven);
+struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp,
+                                       unsigned int req_flags);
 void ncsi_free_request(struct ncsi_request *nr);
 struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
 int ncsi_process_next_channel(struct ncsi_dev_priv *ndp);