Commit c84af579 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[LLC] move sap->rcv_func call to llc_rcv

parent 0284d996
...@@ -63,5 +63,4 @@ extern void llc_station_state_process(struct llc_station *station, ...@@ -63,5 +63,4 @@ extern void llc_station_state_process(struct llc_station *station,
extern void llc_station_send_pdu(struct llc_station *station, extern void llc_station_send_pdu(struct llc_station *station,
struct sk_buff *skb); struct sk_buff *skb);
extern struct sk_buff *llc_alloc_frame(void); extern struct sk_buff *llc_alloc_frame(void);
extern struct packet_type llc_packet_type;
#endif /* LLC_MAIN_H */ #endif /* LLC_MAIN_H */
...@@ -42,8 +42,7 @@ struct llc_sap { ...@@ -42,8 +42,7 @@ struct llc_sap {
extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk); extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk); extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb);
struct packet_type *pt);
extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb); extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb);
#endif /* LLC_SAP_H */ #endif /* LLC_SAP_H */
...@@ -107,7 +107,7 @@ void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, ...@@ -107,7 +107,7 @@ void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
ev->type = LLC_SAP_EV_TYPE_PRIM; ev->type = LLC_SAP_EV_TYPE_PRIM;
ev->prim = LLC_DATAUNIT_PRIM; ev->prim = LLC_DATAUNIT_PRIM;
ev->prim_type = LLC_PRIM_TYPE_REQ; ev->prim_type = LLC_PRIM_TYPE_REQ;
llc_sap_state_process(sap, skb, &llc_packet_type); llc_sap_state_process(sap, skb);
} }
/** /**
...@@ -133,7 +133,7 @@ void llc_build_and_send_test_pkt(struct llc_sap *sap, ...@@ -133,7 +133,7 @@ void llc_build_and_send_test_pkt(struct llc_sap *sap,
ev->type = LLC_SAP_EV_TYPE_PRIM; ev->type = LLC_SAP_EV_TYPE_PRIM;
ev->prim = LLC_TEST_PRIM; ev->prim = LLC_TEST_PRIM;
ev->prim_type = LLC_PRIM_TYPE_REQ; ev->prim_type = LLC_PRIM_TYPE_REQ;
llc_sap_state_process(sap, skb, &llc_packet_type); llc_sap_state_process(sap, skb);
} }
/** /**
...@@ -159,7 +159,7 @@ void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, ...@@ -159,7 +159,7 @@ void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
ev->type = LLC_SAP_EV_TYPE_PRIM; ev->type = LLC_SAP_EV_TYPE_PRIM;
ev->prim = LLC_XID_PRIM; ev->prim = LLC_XID_PRIM;
ev->prim_type = LLC_PRIM_TYPE_REQ; ev->prim_type = LLC_PRIM_TYPE_REQ;
llc_sap_state_process(sap, skb, &llc_packet_type); llc_sap_state_process(sap, skb);
} }
/** /**
......
...@@ -37,8 +37,7 @@ u8 llc_mac_null_var[IFHWADDRLEN]; ...@@ -37,8 +37,7 @@ u8 llc_mac_null_var[IFHWADDRLEN];
static void fix_up_incoming_skb(struct sk_buff *skb); static void fix_up_incoming_skb(struct sk_buff *skb);
static void llc_station_rcv(struct sk_buff *skb); static void llc_station_rcv(struct sk_buff *skb);
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb);
struct packet_type *pt);
/** /**
* mac_send_pdu - Sends PDU to specific device. * mac_send_pdu - Sends PDU to specific device.
...@@ -114,16 +113,22 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -114,16 +113,22 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
} }
llc_decode_pdu_type(skb, &dest); llc_decode_pdu_type(skb, &dest);
if (dest == LLC_DEST_SAP) { /* type 1 services */ if (dest == LLC_DEST_SAP) { /* type 1 services */
struct llc_addr laddr; if (sap->rcv_func)
struct sock *sk; sap->rcv_func(skb, dev, pt);
else {
struct llc_addr laddr;
struct sock *sk;
llc_pdu_decode_da(skb, laddr.mac); llc_pdu_decode_da(skb, laddr.mac);
llc_pdu_decode_dsap(skb, &laddr.lsap); llc_pdu_decode_dsap(skb, &laddr.lsap);
skb->sk = sk = llc_lookup_dgram(sap, &laddr); sk = llc_lookup_dgram(sap, &laddr);
llc_sap_rcv(sap, skb, pt); if (!sk)
if (sk) goto drop;
skb->sk = sk;
llc_sap_rcv(sap, skb);
sock_put(sk); sock_put(sk);
}
} else if (dest == LLC_DEST_CONN) { } else if (dest == LLC_DEST_CONN) {
struct llc_addr saddr, daddr; struct llc_addr saddr, daddr;
struct sock *sk; struct sock *sk;
...@@ -254,18 +259,16 @@ int llc_conn_rcv(struct sock* sk, struct sk_buff *skb) ...@@ -254,18 +259,16 @@ int llc_conn_rcv(struct sock* sk, struct sk_buff *skb)
* llc_sap_rcv - sends received pdus to the sap state machine * llc_sap_rcv - sends received pdus to the sap state machine
* @sap: current sap component structure. * @sap: current sap component structure.
* @skb: received frame. * @skb: received frame.
* @pt: packet type
* *
* Sends received pdus to the sap state machine. * Sends received pdus to the sap state machine.
*/ */
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb)
struct packet_type *pt)
{ {
struct llc_sap_state_ev *ev = llc_sap_ev(skb); struct llc_sap_state_ev *ev = llc_sap_ev(skb);
ev->type = LLC_SAP_EV_TYPE_PDU; ev->type = LLC_SAP_EV_TYPE_PDU;
ev->reason = 0; ev->reason = 0;
llc_sap_state_process(sap, skb, pt); llc_sap_state_process(sap, skb);
} }
/** /**
......
...@@ -613,7 +613,7 @@ static int llc_proc_get_info(char *bf, char **start, off_t offset, int length) ...@@ -613,7 +613,7 @@ static int llc_proc_get_info(char *bf, char **start, off_t offset, int length)
return len; return len;
} }
struct packet_type llc_packet_type = { static struct packet_type llc_packet_type = {
.type = __constant_htons(ETH_P_802_2), .type = __constant_htons(ETH_P_802_2),
.func = llc_rcv, .func = llc_rcv,
.data = (void *)1, .data = (void *)1,
......
...@@ -79,14 +79,12 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk) ...@@ -79,14 +79,12 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk)
* llc_sap_state_process - sends event to SAP state machine * llc_sap_state_process - sends event to SAP state machine
* @sap: sap to use * @sap: sap to use
* @skb: pointer to occurred event * @skb: pointer to occurred event
* @pt: packet type, for datalink protos
* *
* After executing actions of the event, upper layer will be indicated * After executing actions of the event, upper layer will be indicated
* if needed(on receiving an UI frame). sk can be null for the * if needed(on receiving an UI frame). sk can be null for the
* datalink_proto case. * datalink_proto case.
*/ */
void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb)
struct packet_type *pt)
{ {
struct llc_sap_state_ev *ev = llc_sap_ev(skb); struct llc_sap_state_ev *ev = llc_sap_ev(skb);
...@@ -99,18 +97,14 @@ void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, ...@@ -99,18 +97,14 @@ void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb,
ev->ind_cfm_flag = 0; ev->ind_cfm_flag = 0;
llc_sap_next_state(sap, skb); llc_sap_next_state(sap, skb);
if (ev->ind_cfm_flag == LLC_IND) { if (ev->ind_cfm_flag == LLC_IND) {
if (sap->rcv_func) if (skb->sk->state == TCP_LISTEN)
sap->rcv_func(skb, skb->dev, pt); kfree_skb(skb);
else { else {
if (skb->sk->state == TCP_LISTEN) llc_save_primitive(skb, ev->prim);
kfree_skb(skb);
else {
llc_save_primitive(skb, ev->prim);
/* queue skb to the user. */ /* queue skb to the user. */
if (sock_queue_rcv_skb(skb->sk, skb)) if (sock_queue_rcv_skb(skb->sk, skb))
kfree_skb(skb); kfree_skb(skb);
}
} }
} }
kfree_skb(skb); kfree_skb(skb);
......
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