LLC: Remove global variables used in confirms and indications

. moved the global variables llc_ind_prim and llc_cfm_prim
  to struct llc_sap, to make the code reentrant
. one kerneldoc comment for a struct
. created llc_pdu_{s,u}n_hdr and llc_set_pdu_hdr to abstract
  access to skb internals (skb->nh.raw)
. renamed llc_get_llc_hdr_length to llc_get_hdr_len and simplify it
. killed some uneeded variables in llc_sap_send_ev
parent 913bd2b6
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#define LLC_GLOBAL_DEFAULT_MAX_NBR_SAPS 4 #define LLC_GLOBAL_DEFAULT_MAX_NBR_SAPS 4
#define LLC_GLOBAL_DEFAULT_MAX_NBR_CONNS 64 #define LLC_GLOBAL_DEFAULT_MAX_NBR_CONNS 64
extern struct llc_prim_if_block llc_ind_prim, llc_cfm_prim;
/* LLC station component (SAP and connection resource manager) */ /* LLC station component (SAP and connection resource manager) */
/* Station component; one per adapter */ /* Station component; one per adapter */
struct llc_station { struct llc_station {
......
...@@ -198,6 +198,11 @@ struct llc_pdu_sn { ...@@ -198,6 +198,11 @@ struct llc_pdu_sn {
u8 ctrl_2; u8 ctrl_2;
}; };
static __inline__ struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
{
return (struct llc_pdu_sn *)skb->nh.raw;
}
/* Un-numbered PDU format (3 bytes in length) */ /* Un-numbered PDU format (3 bytes in length) */
struct llc_pdu_un { struct llc_pdu_un {
u8 dsap; u8 dsap;
...@@ -205,6 +210,16 @@ struct llc_pdu_un { ...@@ -205,6 +210,16 @@ struct llc_pdu_un {
u8 ctrl_1; u8 ctrl_1;
}; };
static __inline__ struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
{
return (struct llc_pdu_un *)skb->nh.raw;
}
static __inline__ void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr)
{
return skb->nh.raw = ptr;
}
/* LLC Type 1 XID command/response information fields format */ /* LLC Type 1 XID command/response information fields format */
struct llc_xid_info { struct llc_xid_info {
u8 fmt_id; /* always 0x18 for LLC */ u8 fmt_id; /* always 0x18 for LLC */
......
...@@ -12,23 +12,38 @@ ...@@ -12,23 +12,38 @@
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*/ */
#include <linux/skbuff.h> #include <linux/skbuff.h>
/* Defines the SAP component */ /**
* struct llc_sap - Defines the SAP component
*
* @p_bit - only lowest-order bit used
* @f_bit - only lowest-order bit used
* @req - provided by LLC layer
* @resp - provided by LLC layer
* @ind - provided by network layer
* @conf - provided by network layer
* @laddr - SAP value in this 'lsap'
* @node - entry in station sap_list
* @sk_list - LLC sockets this one manages
* @mac_pdu_q - PDUs ready to send to MAC
*/
struct llc_sap { struct llc_sap {
u8 state; struct llc_station *parent_station;
struct llc_station *parent_station; u8 state;
u8 p_bit; /* only lowest-order bit used */ u8 p_bit;
u8 f_bit; /* only lowest-order bit used */ u8 f_bit;
llc_prim_call_t req; /* provided by LLC layer */ llc_prim_call_t req;
llc_prim_call_t resp; /* provided by LLC layer */ llc_prim_call_t resp;
llc_prim_call_t ind; /* provided by network layer */ llc_prim_call_t ind;
llc_prim_call_t conf; /* provided by network layer */ llc_prim_call_t conf;
struct llc_addr laddr; /* SAP value in this 'lsap' */ struct llc_prim_if_block llc_ind_prim, llc_cfm_prim;
struct list_head node; /* entry in station sap_list */ union llc_u_prim_data llc_ind_data_prim, llc_cfm_data_prim;
struct llc_addr laddr;
struct list_head node;
struct { struct {
spinlock_t lock; spinlock_t lock;
struct list_head list; struct list_head list;
} sk_list; /* LLC sockets this one manages */ } sk_list;
struct sk_buff_head mac_pdu_q; /* PDUs ready to send to MAC */ struct sk_buff_head mac_pdu_q;
}; };
struct llc_sap_state_ev; struct llc_sap_state_ev;
......
...@@ -61,15 +61,18 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -61,15 +61,18 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
int rc = 1; int rc = 1;
u8 dsap;
struct sk_buff *skb = ev->data.pdu.skb; struct sk_buff *skb = ev->data.pdu.skb;
union llc_u_prim_data *prim_data = llc_ind_prim.data;
struct llc_prim_if_block *prim = &llc_ind_prim;
struct llc_sap *sap; struct llc_sap *sap;
struct llc_opt *llc = llc_sk(sk);
llc_pdu_decode_dsap(skb, &prim_data->conn.daddr.lsap); llc_pdu_decode_dsap(skb, &dsap);
sap = llc_sap_find(prim_data->conn.daddr.lsap); sap = llc_sap_find(dsap);
if (sap) { if (sap) {
struct llc_prim_if_block *prim = &sap->llc_ind_prim;
union llc_u_prim_data *prim_data = prim->data;
struct llc_opt *llc = llc_sk(sk);
prim_data->conn.daddr.lsap = dsap;
llc_pdu_decode_sa(skb, llc->daddr.mac); llc_pdu_decode_sa(skb, llc->daddr.mac);
llc_pdu_decode_da(skb, llc->laddr.mac); llc_pdu_decode_da(skb, llc->laddr.mac);
llc->dev = skb->dev; llc->dev = skb->dev;
...@@ -90,14 +93,11 @@ int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -90,14 +93,11 @@ int llc_conn_ac_conn_ind(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
union llc_u_prim_data *prim_data = llc_cfm_prim.data;
struct sk_buff *skb = ev->data.pdu.skb; struct sk_buff *skb = ev->data.pdu.skb;
/* FIXME: wtf, this is global, so the whole thing is really
* non reentrant...
*/
struct llc_prim_if_block *prim = &llc_cfm_prim;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
struct llc_sap *sap = llc->sap; struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_cfm_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->conn.sk = sk; prim_data->conn.sk = sk;
prim_data->conn.pri = 0; prim_data->conn.pri = 0;
...@@ -118,17 +118,19 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -118,17 +118,19 @@ int llc_conn_ac_conn_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
static int llc_conn_ac_data_confirm(struct sock *sk, static int llc_conn_ac_data_confirm(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_prim_if_block *prim = &llc_cfm_prim; struct llc_opt *llc = llc_sk(sk);
union llc_u_prim_data *prim_data = llc_cfm_prim.data; struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_cfm_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->data.sk = sk; prim_data->data.sk = sk;
prim_data->data.pri = 0; prim_data->data.pri = 0;
prim_data->data.link = llc_sk(sk)->link; prim_data->data.link = llc->link;
prim_data->data.status = LLC_STATUS_RECEIVED; prim_data->data.status = LLC_STATUS_RECEIVED;
prim_data->data.skb = NULL; prim_data->data.skb = NULL;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_DATA_PRIM; prim->prim = LLC_DATA_PRIM;
prim->sap = llc_sk(sk)->sap; prim->sap = sap;
ev->flag = 1; ev->flag = 1;
ev->cfm_prim = prim; ev->cfm_prim = prim;
return 0; return 0;
...@@ -144,12 +146,9 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -144,12 +146,9 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
u8 reason = 0; u8 reason = 0;
int rc = 1; int rc = 1;
union llc_u_prim_data *prim_data = llc_ind_prim.data;
struct llc_prim_if_block *prim = &llc_ind_prim;
if (ev->type == LLC_CONN_EV_TYPE_PDU) { if (ev->type == LLC_CONN_EV_TYPE_PDU) {
struct llc_pdu_un *pdu = struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
(struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_RSP(pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -170,12 +169,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -170,12 +169,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
rc = 1; rc = 1;
} }
if (!rc) { if (!rc) {
struct llc_opt *llc = llc_sk(sk);
struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_ind_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->disc.sk = sk; prim_data->disc.sk = sk;
prim_data->disc.reason = reason; prim_data->disc.reason = reason;
prim_data->disc.link = llc_sk(sk)->link; prim_data->disc.link = llc->link;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_DISC_PRIM; prim->prim = LLC_DISC_PRIM;
prim->sap = llc_sk(sk)->sap; prim->sap = llc->sap;
ev->flag = 1; ev->flag = 1;
ev->ind_prim = prim; ev->ind_prim = prim;
} }
...@@ -184,15 +188,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -184,15 +188,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_disc_confirm(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_disc_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
union llc_u_prim_data *prim_data = llc_cfm_prim.data; struct llc_opt *llc = llc_sk(sk);
struct llc_prim_if_block *prim = &llc_cfm_prim; struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_cfm_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->disc.sk = sk; prim_data->disc.sk = sk;
prim_data->disc.reason = ev->status; prim_data->disc.reason = ev->status;
prim_data->disc.link = llc_sk(sk)->link; prim_data->disc.link = llc->link;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_DISC_PRIM; prim->prim = LLC_DISC_PRIM;
prim->sap = llc_sk(sk)->sap; prim->sap = sap;
ev->flag = 1; ev->flag = 1;
ev->cfm_prim = prim; ev->cfm_prim = prim;
return 0; return 0;
...@@ -202,9 +208,7 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -202,9 +208,7 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
u8 reason = 0; u8 reason = 0;
int rc = 1; int rc = 1;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
union llc_u_prim_data *prim_data = llc_ind_prim.data;
struct llc_prim_if_block *prim = &llc_ind_prim;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
switch (ev->type) { switch (ev->type) {
...@@ -237,12 +241,16 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -237,12 +241,16 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
break; break;
} }
if (!rc) { if (!rc) {
struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_ind_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->res.sk = sk; prim_data->res.sk = sk;
prim_data->res.reason = reason; prim_data->res.reason = reason;
prim_data->res.link = llc->link; prim_data->res.link = llc->link;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_RESET_PRIM; prim->prim = LLC_RESET_PRIM;
prim->sap = llc->sap; prim->sap = sap;
ev->flag = 1; ev->flag = 1;
ev->ind_prim = prim; ev->ind_prim = prim;
} }
...@@ -251,14 +259,16 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -251,14 +259,16 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_rst_confirm(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_rst_confirm(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
union llc_u_prim_data *prim_data = llc_cfm_prim.data; struct llc_opt *llc = llc_sk(sk);
struct llc_prim_if_block *prim = &llc_cfm_prim; struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_cfm_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->res.sk = sk; prim_data->res.sk = sk;
prim_data->res.link = llc_sk(sk)->link; prim_data->res.link = llc->link;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_RESET_PRIM; prim->prim = LLC_RESET_PRIM;
prim->sap = llc_sk(sk)->sap; prim->sap = sap;
ev->flag = 1; ev->flag = 1;
ev->cfm_prim = prim; ev->cfm_prim = prim;
return 0; return 0;
......
...@@ -87,10 +87,10 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr) ...@@ -87,10 +87,10 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr)
if (!skb_queue_len(&llc->pdu_unack_q)) if (!skb_queue_len(&llc->pdu_unack_q))
goto out; goto out;
skb = skb_peek(&llc->pdu_unack_q); skb = skb_peek(&llc->pdu_unack_q);
pdu = (struct llc_pdu_sn *)skb->nh.raw; pdu = llc_pdu_sn_hdr(skb);
nr1 = LLC_I_GET_NS(pdu); nr1 = LLC_I_GET_NS(pdu);
skb = skb_peek_tail(&llc->pdu_unack_q); skb = skb_peek_tail(&llc->pdu_unack_q);
pdu = (struct llc_pdu_sn *)skb->nh.raw; pdu = llc_pdu_sn_hdr(skb);
nr2 = LLC_I_GET_NS(pdu); nr2 = LLC_I_GET_NS(pdu);
rc = !llc_circular_between(nr1, nr, (nr2 + 1) % LLC_2_SEQ_NBR_MODULO); rc = !llc_circular_between(nr1, nr, (nr2 + 1) % LLC_2_SEQ_NBR_MODULO);
out: out:
...@@ -155,7 +155,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -155,7 +155,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1; LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1;
...@@ -164,7 +164,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, ...@@ -164,7 +164,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk,
int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1;
...@@ -173,7 +173,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, ...@@ -173,7 +173,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1;
...@@ -182,7 +182,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, ...@@ -182,7 +182,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_0(pdu) && !LLC_I_PF_IS_0(pdu) &&
...@@ -192,7 +192,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, ...@@ -192,7 +192,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_1(pdu) && !LLC_I_PF_IS_1(pdu) &&
...@@ -202,7 +202,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, ...@@ -202,7 +202,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -214,7 +214,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, ...@@ -214,7 +214,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -226,7 +226,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, ...@@ -226,7 +226,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn * pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
u16 rc = !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr && u16 rc = !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr &&
...@@ -241,7 +241,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, ...@@ -241,7 +241,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_0(pdu) && !LLC_I_PF_IS_0(pdu) &&
...@@ -251,7 +251,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, ...@@ -251,7 +251,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_1(pdu) && !LLC_I_PF_IS_1(pdu) &&
...@@ -261,7 +261,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, ...@@ -261,7 +261,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
LLC_I_GET_NS(pdu) == llc_sk(sk)->vR ? 0 : 1; LLC_I_GET_NS(pdu) == llc_sk(sk)->vR ? 0 : 1;
...@@ -270,7 +270,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, ...@@ -270,7 +270,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -282,7 +282,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, ...@@ -282,7 +282,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -294,7 +294,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, ...@@ -294,7 +294,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -305,7 +305,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, ...@@ -305,7 +305,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
u16 rc = !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr && u16 rc = !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr &&
...@@ -320,7 +320,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, ...@@ -320,7 +320,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -330,7 +330,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, ...@@ -330,7 +330,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -340,7 +340,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, ...@@ -340,7 +340,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -350,7 +350,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, ...@@ -350,7 +350,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -360,7 +360,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, ...@@ -360,7 +360,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1; LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1;
...@@ -369,7 +369,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, ...@@ -369,7 +369,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -379,7 +379,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, ...@@ -379,7 +379,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -389,7 +389,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, ...@@ -389,7 +389,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -399,7 +399,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, ...@@ -399,7 +399,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -409,7 +409,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, ...@@ -409,7 +409,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -419,7 +419,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, ...@@ -419,7 +419,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -429,7 +429,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, ...@@ -429,7 +429,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -439,7 +439,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, ...@@ -439,7 +439,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -449,7 +449,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, ...@@ -449,7 +449,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1; LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1;
...@@ -458,7 +458,7 @@ int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, ...@@ -458,7 +458,7 @@ int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_UA ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_UA ? 0 : 1;
...@@ -468,7 +468,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, ...@@ -468,7 +468,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -484,7 +484,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk, ...@@ -484,7 +484,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -506,7 +506,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, ...@@ -506,7 +506,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
...@@ -526,7 +526,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, ...@@ -526,7 +526,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
if (!LLC_PDU_IS_RSP(pdu)) { if (!LLC_PDU_IS_RSP(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -549,7 +549,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, ...@@ -549,7 +549,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
if (!LLC_PDU_IS_RSP(pdu)) { if (!LLC_PDU_IS_RSP(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
...@@ -570,7 +570,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, ...@@ -570,7 +570,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
rc = 0; rc = 0;
...@@ -591,7 +591,7 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk, ...@@ -591,7 +591,7 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vs = llc_sk(sk)->vS; u8 vs = llc_sk(sk)->vS;
u8 nr = LLC_I_GET_NR(pdu); u8 nr = LLC_I_GET_NR(pdu);
...@@ -613,7 +613,7 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk, ...@@ -613,7 +613,7 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(ev->data.pdu.skb);
u8 vs = llc_sk(sk)->vS; u8 vs = llc_sk(sk)->vS;
u8 nr = LLC_I_GET_NR(pdu); u8 nr = LLC_I_GET_NR(pdu);
......
...@@ -134,16 +134,18 @@ void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) ...@@ -134,16 +134,18 @@ void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb, void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
struct llc_prim_if_block *prim = &llc_ind_prim; struct llc_opt *llc = llc_sk(sk);
union llc_u_prim_data *prim_data = llc_ind_prim.data; struct llc_sap *sap = llc->sap;
struct llc_prim_if_block *prim = &sap->llc_ind_prim;
union llc_u_prim_data *prim_data = prim->data;
prim_data->data.sk = sk; prim_data->data.sk = sk;
prim_data->data.pri = 0; prim_data->data.pri = 0;
prim_data->data.skb = skb; prim_data->data.skb = skb;
prim_data->data.link = llc_sk(sk)->link; prim_data->data.link = llc->link;
prim->data = prim_data; prim->data = prim_data;
prim->prim = LLC_DATA_PRIM; prim->prim = LLC_DATA_PRIM;
prim->sap = llc_sk(sk)->sap; prim->sap = sap;
ev->flag = 1; ev->flag = 1;
/* saving prepd prim in event for future use in llc_conn_send_ev */ /* saving prepd prim in event for future use in llc_conn_send_ev */
ev->ind_prim = prim; ev->ind_prim = prim;
......
...@@ -56,7 +56,7 @@ int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct llc_station *station, ...@@ -56,7 +56,7 @@ int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station, int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_CMD(pdu) && /* command PDU */ !LLC_PDU_IS_CMD(pdu) && /* command PDU */
...@@ -68,7 +68,7 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station, ...@@ -68,7 +68,7 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station, int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_RSP(pdu) && /* response PDU */ !LLC_PDU_IS_RSP(pdu) && /* response PDU */
...@@ -81,7 +81,7 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station, ...@@ -81,7 +81,7 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station, int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_RSP(pdu) && /* response PDU */ !LLC_PDU_IS_RSP(pdu) && /* response PDU */
...@@ -94,7 +94,7 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station, ...@@ -94,7 +94,7 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station, int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_CMD(pdu) && /* command PDU */ !LLC_PDU_IS_CMD(pdu) && /* command PDU */
......
...@@ -90,7 +90,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev, ...@@ -90,7 +90,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
if (!skb) if (!skb)
goto out; goto out;
fix_up_incoming_skb(skb); fix_up_incoming_skb(skb);
pdu = (struct llc_pdu_sn *)skb->nh.raw; pdu = llc_pdu_sn_hdr(skb);
if (!pdu->dsap) { /* NULL DSAP, refer to station */ if (!pdu->dsap) { /* NULL DSAP, refer to station */
if (llc_pdu_router(NULL, NULL, skb, 0)) if (llc_pdu_router(NULL, NULL, skb, 0))
goto drop; goto drop;
...@@ -202,7 +202,7 @@ static void fix_up_incoming_skb(struct sk_buff *skb) ...@@ -202,7 +202,7 @@ static void fix_up_incoming_skb(struct sk_buff *skb)
int llc_pdu_router(struct llc_sap *sap, struct sock* sk, int llc_pdu_router(struct llc_sap *sap, struct sock* sk,
struct sk_buff *skb, u8 type) struct sk_buff *skb, u8 type)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
int rc = 0; int rc = 0;
if (!pdu->dsap) { if (!pdu->dsap) {
......
...@@ -51,8 +51,6 @@ static struct llc_station_state_trans * ...@@ -51,8 +51,6 @@ static struct llc_station_state_trans *
static int llc_rtn_all_conns(struct llc_sap *sap); static int llc_rtn_all_conns(struct llc_sap *sap);
static struct llc_station llc_main_station; /* only one of its kind */ static struct llc_station llc_main_station; /* only one of its kind */
struct llc_prim_if_block llc_ind_prim, llc_cfm_prim;
static union llc_u_prim_data llc_ind_data_prim, llc_cfm_data_prim;
/** /**
* llc_sap_alloc - allocates and initializes sap. * llc_sap_alloc - allocates and initializes sap.
...@@ -70,6 +68,8 @@ struct llc_sap *llc_sap_alloc(void) ...@@ -70,6 +68,8 @@ struct llc_sap *llc_sap_alloc(void)
spin_lock_init(&sap->sk_list.lock); spin_lock_init(&sap->sk_list.lock);
INIT_LIST_HEAD(&sap->sk_list.list); INIT_LIST_HEAD(&sap->sk_list.list);
skb_queue_head_init(&sap->mac_pdu_q); skb_queue_head_init(&sap->mac_pdu_q);
sap->llc_ind_prim.data = &sap->llc_ind_data_prim;
sap->llc_cfm_prim.data = &sap->llc_cfm_data_prim;
} }
return sap; return sap;
} }
...@@ -618,8 +618,6 @@ static int __init llc_init(void) ...@@ -618,8 +618,6 @@ static int __init llc_init(void)
ev->type = LLC_STATION_EV_TYPE_SIMPLE; ev->type = LLC_STATION_EV_TYPE_SIMPLE;
ev->data.a.ev = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK; ev->data.a.ev = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK;
rc = llc_station_next_state(&llc_main_station, ev); rc = llc_station_next_state(&llc_main_station, ev);
llc_ind_prim.data = &llc_ind_data_prim;
llc_cfm_prim.data = &llc_cfm_data_prim;
proc_net_create("802.2", 0, llc_proc_get_info); proc_net_create("802.2", 0, llc_proc_get_info);
llc_ui_init(); llc_ui_init();
dev_add_pack(&llc_packet_type); dev_add_pack(&llc_packet_type);
......
...@@ -19,26 +19,23 @@ ...@@ -19,26 +19,23 @@
#include <net/llc_main.h> #include <net/llc_main.h>
static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type); static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type);
static int llc_get_llc_hdr_length(u8 pdu_type); static __inline__ int llc_get_hdr_len(u8 pdu_type);
static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu); static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu);
/** /**
* llc_pdu_header_init - initializes pdu header * llc_pdu_header_init - initializes pdu header
* @skb: input skb that header must be set into it. * @skb: input skb that header must be set into it.
* @pdu_type: type of PDU (U, I or S). * @type: type of PDU (U, I or S).
* @ssap: source sap. * @ssap: source sap.
* @dsap: destination sap. * @dsap: destination sap.
* @cr: command/response bit (0 or 1). * @cr: command/response bit (0 or 1).
* *
* This function sets DSAP, SSAP and command/Response bit in LLC header. * This function sets DSAP, SSAP and command/Response bit in LLC header.
*/ */
void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap, void llc_pdu_header_init(struct sk_buff *skb, u8 type, u8 ssap, u8 dsap, u8 cr)
u8 dsap, u8 cr)
{ {
struct llc_pdu_un *pdu; struct llc_pdu_un *pdu =
llc_set_pdu_hdr(skb, skb_push(skb, llc_get_hdr_len(type)));
skb->nh.raw = skb_push(skb, llc_get_llc_hdr_length(pdu_type));
pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->dsap = dsap; pdu->dsap = dsap;
pdu->ssap = ssap; pdu->ssap = ssap;
pdu->ssap |= cr; pdu->ssap |= cr;
...@@ -46,7 +43,7 @@ void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap, ...@@ -46,7 +43,7 @@ void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap,
void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type) void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type)
{ {
((struct llc_pdu_un *)skb->nh.raw)->ssap |= pdu_type; llc_pdu_un_hdr(skb)->ssap |= pdu_type;
} }
/** /**
...@@ -66,7 +63,7 @@ void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value) ...@@ -66,7 +63,7 @@ void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value)
if (llc_pdu_decode_pdu_type(skb, &pdu_type)) if (llc_pdu_decode_pdu_type(skb, &pdu_type))
goto out; goto out;
pdu = (struct llc_pdu_sn *)skb->nh.raw; pdu = llc_pdu_sn_hdr(skb);
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
...@@ -98,7 +95,7 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit) ...@@ -98,7 +95,7 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit)
if (rc) if (rc)
goto out; goto out;
pdu = (struct llc_pdu_sn *)skb->nh.raw; pdu = llc_pdu_sn_hdr(skb);
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
...@@ -123,8 +120,7 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit) ...@@ -123,8 +120,7 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit)
*/ */
int llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit) int llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit)
{ {
*cr_bit = ((struct llc_pdu_un *)skb->nh.raw)->ssap & *cr_bit = llc_pdu_un_hdr(skb)->ssap & LLC_PDU_CMD_RSP_MASK;
LLC_PDU_CMD_RSP_MASK;
return 0; return 0;
} }
...@@ -170,7 +166,7 @@ int llc_pdu_decode_da(struct sk_buff *skb, u8 *da) ...@@ -170,7 +166,7 @@ int llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
*/ */
int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap) int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap)
{ {
*dsap = ((struct llc_pdu_un *)skb->nh.raw)->dsap & 0xFE; *dsap = llc_pdu_un_hdr(skb)->dsap & 0xFE;
return 0; return 0;
} }
...@@ -184,7 +180,7 @@ int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap) ...@@ -184,7 +180,7 @@ int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap)
*/ */
int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap) int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
{ {
*ssap = ((struct llc_pdu_un *)skb->nh.raw)->ssap & 0xFE; *ssap = llc_pdu_un_hdr(skb)->ssap & 0xFE;
return 0; return 0;
} }
...@@ -196,7 +192,7 @@ int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap) ...@@ -196,7 +192,7 @@ int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
*/ */
int llc_pdu_init_as_ui_cmd(struct sk_buff *skb) int llc_pdu_init_as_ui_cmd(struct sk_buff *skb)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_UI; pdu->ctrl_1 |= LLC_1_PDU_CMD_UI;
...@@ -214,7 +210,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported, ...@@ -214,7 +210,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window) u8 rx_window)
{ {
struct llc_xid_info *xid_info; struct llc_xid_info *xid_info;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; pdu->ctrl_1 |= LLC_1_PDU_CMD_XID;
...@@ -235,7 +231,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported, ...@@ -235,7 +231,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
*/ */
int llc_pdu_init_as_test_cmd(struct sk_buff *skb) int llc_pdu_init_as_test_cmd(struct sk_buff *skb)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
...@@ -252,7 +248,7 @@ int llc_pdu_init_as_test_cmd(struct sk_buff *skb) ...@@ -252,7 +248,7 @@ int llc_pdu_init_as_test_cmd(struct sk_buff *skb)
*/ */
int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC; pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC;
...@@ -271,7 +267,7 @@ int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) ...@@ -271,7 +267,7 @@ int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit)
*/ */
int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr) int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_I; pdu->ctrl_1 = LLC_PDU_TYPE_I;
pdu->ctrl_2 = 0; pdu->ctrl_2 = 0;
...@@ -291,7 +287,7 @@ int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr) ...@@ -291,7 +287,7 @@ int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr)
*/ */
int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ; pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ;
...@@ -312,7 +308,7 @@ int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -312,7 +308,7 @@ int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR; pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR;
...@@ -333,7 +329,7 @@ int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -333,7 +329,7 @@ int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RR; pdu->ctrl_1 |= LLC_2_PDU_CMD_RR;
...@@ -352,7 +348,7 @@ int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -352,7 +348,7 @@ int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit) int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME; pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME;
...@@ -369,7 +365,7 @@ int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit) ...@@ -369,7 +365,7 @@ int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
*/ */
int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit) int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_DM; pdu->ctrl_1 |= LLC_2_PDU_RSP_DM;
...@@ -389,7 +385,7 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported, ...@@ -389,7 +385,7 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window) u8 rx_window)
{ {
struct llc_xid_info *xid_info; struct llc_xid_info *xid_info;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; pdu->ctrl_1 |= LLC_1_PDU_CMD_XID;
...@@ -413,15 +409,16 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported, ...@@ -413,15 +409,16 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb) int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb)
{ {
int dsize; int dsize;
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; pdu->ctrl_1 |= LLC_U_PF_BIT_MASK;
if (ev_skb->protocol == ntohs(ETH_P_802_2)) { if (ev_skb->protocol == ntohs(ETH_P_802_2)) {
struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb);
dsize = ntohs(((struct ethhdr *)ev_skb->mac.raw)->h_proto) - 3; dsize = ntohs(((struct ethhdr *)ev_skb->mac.raw)->h_proto) - 3;
memcpy(((u8 *)skb->nh.raw) + 3, memcpy(((u8 *)pdu) + 3, ((u8 *)ev_pdu) + 3, dsize);
((u8 *)ev_skb->nh.raw) + 3, dsize);
skb_put(skb, dsize); skb_put(skb, dsize);
} }
return 0; return 0;
...@@ -444,7 +441,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu, ...@@ -444,7 +441,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
struct llc_frmr_info *frmr_info; struct llc_frmr_info *frmr_info;
u8 prev_pf = 0; u8 prev_pf = 0;
u8 *ctrl; u8 *ctrl;
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_FRMR; pdu->ctrl_1 |= LLC_2_PDU_RSP_FRMR;
...@@ -476,7 +473,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu, ...@@ -476,7 +473,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
*/ */
int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_RR; pdu->ctrl_1 |= LLC_2_PDU_RSP_RR;
...@@ -497,7 +494,7 @@ int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -497,7 +494,7 @@ int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ; pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ;
...@@ -518,7 +515,7 @@ int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -518,7 +515,7 @@ int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_RNR; pdu->ctrl_1 |= LLC_2_PDU_RSP_RNR;
...@@ -538,7 +535,7 @@ int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -538,7 +535,7 @@ int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit) int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_UA; pdu->ctrl_1 |= LLC_2_PDU_RSP_UA;
...@@ -555,7 +552,7 @@ int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit) ...@@ -555,7 +552,7 @@ int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
*/ */
static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type) static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
if (pdu->ctrl_1 & 1) { if (pdu->ctrl_1 & 1) {
if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U)
...@@ -577,7 +574,7 @@ static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type) ...@@ -577,7 +574,7 @@ static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type)
int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest) int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest)
{ {
u8 type = LLC_DEST_CONN; /* I-PDU or S-PDU type */ u8 type = LLC_DEST_CONN; /* I-PDU or S-PDU type */
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U)
goto out; goto out;
...@@ -603,26 +600,21 @@ int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest) ...@@ -603,26 +600,21 @@ int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest)
} }
/** /**
* get_llc_hdr_len - designates LLC header length * llc_get_hdr_len - designates LLC header length
* @pdu_type: type of PDU. * @type: type of PDU.
* *
* This function designates LLC header length of PDU. header length for I * This function designates LLC header length of PDU. header length for I
* and S PDU is 4 and for U is 3 bytes. Returns the length of header. * and S PDU is 4 and for U is 3 bytes. Returns the length of header.
*/ */
static int llc_get_llc_hdr_length(u8 pdu_type) static __inline__ int llc_get_hdr_len(u8 type)
{ {
int rtn_val = 0; static int hdr_len[] = {
[LLC_PDU_TYPE_U] = 3,
[LLC_PDU_TYPE_I] = 4,
[LLC_PDU_TYPE_S] = 4,
};
switch (pdu_type) { return hdr_len[type];
case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S:
rtn_val = 4;
break;
case LLC_PDU_TYPE_U:
rtn_val = 3;
break;
}
return rtn_val;
} }
/** /**
......
...@@ -28,7 +28,7 @@ int llc_sap_ev_activation_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -28,7 +28,7 @@ int llc_sap_ev_activation_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -52,7 +52,7 @@ int llc_sap_ev_xid_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -52,7 +52,7 @@ int llc_sap_ev_xid_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -61,7 +61,7 @@ int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -61,7 +61,7 @@ int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -77,7 +77,7 @@ int llc_sap_ev_test_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -77,7 +77,7 @@ int llc_sap_ev_test_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -86,7 +86,7 @@ int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -86,7 +86,7 @@ int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = llc_pdu_un_hdr(ev->data.pdu.skb);
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
......
...@@ -89,15 +89,10 @@ struct llc_sap_state_ev *llc_sap_alloc_ev(struct llc_sap *sap) ...@@ -89,15 +89,10 @@ struct llc_sap_state_ev *llc_sap_alloc_ev(struct llc_sap *sap)
*/ */
void llc_sap_send_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev) void llc_sap_send_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
struct llc_prim_if_block *prim;
u8 flag;
llc_sap_next_state(sap, ev); llc_sap_next_state(sap, ev);
flag = ev->ind_cfm_flag; if (ev->ind_cfm_flag == LLC_IND) {
prim = ev->prim;
if (flag == LLC_IND) {
skb_get(ev->data.pdu.skb); skb_get(ev->data.pdu.skb);
sap->ind(prim); sap->ind(ev->prim);
} }
llc_sap_free_ev(sap, ev); llc_sap_free_ev(sap, ev);
} }
...@@ -112,8 +107,8 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb, ...@@ -112,8 +107,8 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb,
struct llc_sap_state_ev *ev) struct llc_sap_state_ev *ev)
{ {
struct llc_pdu_un *pdu; struct llc_pdu_un *pdu;
struct llc_prim_if_block *prim = &llc_ind_prim; struct llc_prim_if_block *prim = &sap->llc_ind_prim;
union llc_u_prim_data *prim_data = llc_ind_prim.data; union llc_u_prim_data *prim_data = prim->data;
u8 lfb; u8 lfb;
llc_pdu_decode_sa(skb, prim_data->udata.saddr.mac); llc_pdu_decode_sa(skb, prim_data->udata.saddr.mac);
...@@ -122,7 +117,7 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb, ...@@ -122,7 +117,7 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb,
llc_pdu_decode_ssap(skb, &prim_data->udata.saddr.lsap); llc_pdu_decode_ssap(skb, &prim_data->udata.saddr.lsap);
prim_data->udata.pri = 0; prim_data->udata.pri = 0;
prim_data->udata.skb = skb; prim_data->udata.skb = skb;
pdu = (struct llc_pdu_un *)skb->nh.raw; pdu = llc_pdu_un_hdr(skb);
switch (LLC_U_PDU_RSP(pdu)) { switch (LLC_U_PDU_RSP(pdu)) {
case LLC_1_PDU_CMD_TEST: case LLC_1_PDU_CMD_TEST:
prim->prim = LLC_TEST_PRIM; prim->prim = LLC_TEST_PRIM;
......
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