o LLC: reorganize llc_station.c to kill useless static prototypes

parent b2f6e430
...@@ -29,65 +29,55 @@ ...@@ -29,65 +29,55 @@
#include <net/llc_s_st.h> #include <net/llc_s_st.h>
#include <net/llc_proc.h> #include <net/llc_proc.h>
/* static function prototypes */
static void llc_station_service_events(struct llc_station *station);
static void llc_station_free_ev(struct llc_station *station,
struct sk_buff *skb);
static void llc_station_send_pdus(struct llc_station *station);
static u16 llc_station_next_state(struct llc_station *station,
struct sk_buff *skb);
static u16 llc_exec_station_trans_actions(struct llc_station *station,
struct llc_station_state_trans *trans,
struct sk_buff *skb);
static struct llc_station_state_trans *
llc_find_station_trans(struct llc_station *station,
struct sk_buff *skb);
static struct llc_station llc_main_station; static struct llc_station llc_main_station;
/** /**
* llc_station_state_process: queue event and try to process queue. * llc_exec_station_trans_actions - executes actions for transition
* @station: Address of the station * @station: Address of the station
* @skb: Address of the event * @trans: Address of the transition
* @skb: Address of the event that caused the transition
* *
* Queues an event (on the station event queue) for handling by the * Executes actions of a transition of the station state machine. Returns
* station state machine and attempts to process any queued-up events. * 0 if all actions complete successfully, nonzero otherwise.
*/ */
void llc_station_state_process(struct llc_station *station, struct sk_buff *skb) static u16 llc_exec_station_trans_actions(struct llc_station *station,
struct llc_station_state_trans *trans,
struct sk_buff *skb)
{ {
spin_lock_bh(&station->ev_q.lock); u16 rc = 0;
skb_queue_tail(&station->ev_q.list, skb); llc_station_action_t *next_action = trans->ev_actions;
llc_station_service_events(station);
spin_unlock_bh(&station->ev_q.lock);
}
/** for (; next_action && *next_action; next_action++)
* llc_station_send_pdu - queues PDU to send if ((*next_action)(station, skb))
* @station: Address of the station rc = 1;
* @skb: Address of the PDU return rc;
*
* Queues a PDU to send to the MAC layer.
*/
void llc_station_send_pdu(struct llc_station *station, struct sk_buff *skb)
{
skb_queue_tail(&station->mac_pdu_q, skb);
llc_station_send_pdus(station);
} }
/** /**
* llc_station_send_pdus - tries to send queued PDUs * llc_find_station_trans - finds transition for this event
* @station: Address of the station * @station: Address of the station
* @skb: Address of the event
* *
* Tries to send any PDUs queued in the station mac_pdu_q to the MAC * Search thru events of the current state of the station until list
* layer. * exhausted or it's obvious that the event is not valid for the current
* state. Returns the address of the transition if cound, %NULL otherwise.
*/ */
static void llc_station_send_pdus(struct llc_station *station) static struct llc_station_state_trans *
llc_find_station_trans(struct llc_station *station,
struct sk_buff *skb)
{ {
struct sk_buff *skb; int i = 0;
struct llc_station_state_trans *rc = NULL;
struct llc_station_state_trans **next_trans;
struct llc_station_state *curr_state =
&llc_station_state_table[station->state - 1];
while ((skb = skb_dequeue(&station->mac_pdu_q)) != NULL) for (next_trans = curr_state->transitions; next_trans[i]->ev; i++)
if (dev_queue_xmit(skb)) if (!next_trans[i]->ev(station, skb)) {
rc = next_trans[i];
break; break;
}
return rc;
} }
/** /**
...@@ -106,26 +96,6 @@ static void llc_station_free_ev(struct llc_station *station, ...@@ -106,26 +96,6 @@ static void llc_station_free_ev(struct llc_station *station,
kfree_skb(skb); kfree_skb(skb);
} }
/**
* llc_station_service_events - service events in the queue
* @station: Address of the station
*
* Get an event from the station event queue (if any); attempt to service
* the event; if event serviced, get the next event (if any) on the event
* queue; if event not service, re-queue the event on the event queue and
* attempt to service the next event; when serviced all events in queue,
* finished; if don't transition to different state, just service all
* events once; if transition to new state, service all events again.
* Caller must hold station->ev_q.lock.
*/
static void llc_station_service_events(struct llc_station *station)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&station->ev_q.list)) != NULL)
llc_station_next_state(station, skb);
}
/** /**
* llc_station_next_state - processes event and goes to the next state * llc_station_next_state - processes event and goes to the next state
* @station: Address of the station * @station: Address of the station
...@@ -165,52 +135,68 @@ static u16 llc_station_next_state(struct llc_station *station, ...@@ -165,52 +135,68 @@ static u16 llc_station_next_state(struct llc_station *station,
} }
/** /**
* llc_find_station_trans - finds transition for this event * llc_station_service_events - service events in the queue
* @station: Address of the station
*
* Get an event from the station event queue (if any); attempt to service
* the event; if event serviced, get the next event (if any) on the event
* queue; if event not service, re-queue the event on the event queue and
* attempt to service the next event; when serviced all events in queue,
* finished; if don't transition to different state, just service all
* events once; if transition to new state, service all events again.
* Caller must hold station->ev_q.lock.
*/
static void llc_station_service_events(struct llc_station *station)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&station->ev_q.list)) != NULL)
llc_station_next_state(station, skb);
}
/**
* llc_station_state_process: queue event and try to process queue.
* @station: Address of the station * @station: Address of the station
* @skb: Address of the event * @skb: Address of the event
* *
* Search thru events of the current state of the station until list * Queues an event (on the station event queue) for handling by the
* exhausted or it's obvious that the event is not valid for the current * station state machine and attempts to process any queued-up events.
* state. Returns the address of the transition if cound, %NULL otherwise.
*/ */
static struct llc_station_state_trans * void llc_station_state_process(struct llc_station *station, struct sk_buff *skb)
llc_find_station_trans(struct llc_station *station,
struct sk_buff *skb)
{ {
int i = 0; spin_lock_bh(&station->ev_q.lock);
struct llc_station_state_trans *rc = NULL; skb_queue_tail(&station->ev_q.list, skb);
struct llc_station_state_trans **next_trans; llc_station_service_events(station);
struct llc_station_state *curr_state = spin_unlock_bh(&station->ev_q.lock);
&llc_station_state_table[station->state - 1]; }
for (next_trans = curr_state->transitions; next_trans[i]->ev; i++) /**
if (!next_trans[i]->ev(station, skb)) { * llc_station_send_pdus - tries to send queued PDUs
rc = next_trans[i]; * @station: Address of the station
*
* Tries to send any PDUs queued in the station mac_pdu_q to the MAC
* layer.
*/
static void llc_station_send_pdus(struct llc_station *station)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&station->mac_pdu_q)) != NULL)
if (dev_queue_xmit(skb))
break; break;
}
return rc;
} }
/** /**
* llc_exec_station_trans_actions - executes actions for transition * llc_station_send_pdu - queues PDU to send
* @station: Address of the station * @station: Address of the station
* @trans: Address of the transition * @skb: Address of the PDU
* @skb: Address of the event that caused the transition
* *
* Executes actions of a transition of the station state machine. Returns * Queues a PDU to send to the MAC layer.
* 0 if all actions complete successfully, nonzero otherwise.
*/ */
static u16 llc_exec_station_trans_actions(struct llc_station *station, void llc_station_send_pdu(struct llc_station *station, struct sk_buff *skb)
struct llc_station_state_trans *trans,
struct sk_buff *skb)
{ {
u16 rc = 0; skb_queue_tail(&station->mac_pdu_q, skb);
llc_station_action_t *next_action = trans->ev_actions; llc_station_send_pdus(station);
for (; next_action && *next_action; next_action++)
if ((*next_action)(station, skb))
rc = 1;
return rc;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment