Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ae15ab84
Commit
ae15ab84
authored
Sep 19, 2003
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o LLC: reorganize llc_station.c to kill useless static prototypes
parent
b2f6e430
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
94 deletions
+80
-94
net/llc/llc_station.c
net/llc/llc_station.c
+80
-94
No files found.
net/llc/llc_station.c
View file @
ae15ab84
...
...
@@ -29,65 +29,55 @@
#include <net/llc_s_st.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
;
/**
* 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
* @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
*
station state machine and attempts to process any queued-up events
.
*
Executes actions of a transition of the station state machine. Returns
*
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
);
skb_queue_tail
(
&
station
->
ev_q
.
list
,
skb
);
llc_station_service_events
(
station
);
spin_unlock_bh
(
&
station
->
ev_q
.
lock
);
}
u16
rc
=
0
;
llc_station_action_t
*
next_action
=
trans
->
ev_actions
;
/**
* llc_station_send_pdu - queues PDU to send
* @station: Address of the station
* @skb: Address of the PDU
*
* 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
);
for
(;
next_action
&&
*
next_action
;
next_action
++
)
if
((
*
next_action
)(
station
,
skb
))
rc
=
1
;
return
rc
;
}
/**
* llc_
station_send_pdus - tries to send queued PDUs
* llc_
find_station_trans - finds transition for this event
* @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
* layer.
* Search thru events of the current state of the station until list
* 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
)
if
(
dev_queue_xmit
(
skb
))
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
if
(
!
next_trans
[
i
]
->
ev
(
station
,
skb
))
{
rc
=
next_trans
[
i
];
break
;
}
return
rc
;
}
/**
...
...
@@ -106,26 +96,6 @@ static void llc_station_free_ev(struct llc_station *station,
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
* @station: Address of the 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
* @skb: Address of the event
*
* Search thru events of the current state of the station until list
* 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.
* Queues an event (on the station event queue) for handling by the
* station state machine and attempts to process any queued-up events.
*/
static
struct
llc_station_state_trans
*
llc_find_station_trans
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
)
void
llc_station_state_process
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
)
{
int
i
=
0
;
s
truct
llc_station_state_trans
*
rc
=
NULL
;
struct
llc_station_state_trans
**
next_trans
;
s
truct
llc_station_state
*
curr_state
=
&
llc_station_state_table
[
station
->
state
-
1
];
spin_lock_bh
(
&
station
->
ev_q
.
lock
)
;
s
kb_queue_tail
(
&
station
->
ev_q
.
list
,
skb
)
;
llc_station_service_events
(
station
)
;
s
pin_unlock_bh
(
&
station
->
ev_q
.
lock
);
}
for
(
next_trans
=
curr_state
->
transitions
;
next_trans
[
i
]
->
ev
;
i
++
)
if
(
!
next_trans
[
i
]
->
ev
(
station
,
skb
))
{
rc
=
next_trans
[
i
];
/**
* llc_station_send_pdus - tries to send queued PDUs
* @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
;
}
return
rc
;
}
/**
* llc_
exec_station_trans_actions - executes actions for transition
* llc_
station_send_pdu - queues PDU to send
* @station: Address of the station
* @trans: Address of the transition
* @skb: Address of the event that caused the transition
* @skb: Address of the PDU
*
* Executes actions of a transition of the station state machine. Returns
* 0 if all actions complete successfully, nonzero otherwise.
* Queues a PDU to send to the MAC layer.
*/
static
u16
llc_exec_station_trans_actions
(
struct
llc_station
*
station
,
struct
llc_station_state_trans
*
trans
,
struct
sk_buff
*
skb
)
void
llc_station_send_pdu
(
struct
llc_station
*
station
,
struct
sk_buff
*
skb
)
{
u16
rc
=
0
;
llc_station_action_t
*
next_action
=
trans
->
ev_actions
;
for
(;
next_action
&&
*
next_action
;
next_action
++
)
if
((
*
next_action
)(
station
,
skb
))
rc
=
1
;
return
rc
;
skb_queue_tail
(
&
station
->
mac_pdu_q
,
skb
);
llc_station_send_pdus
(
station
);
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment