/* This function is called when upper layer wants to send data using connection oriented communication mode. During sending data, connection will be locked and received frames and expired timers will be queued. Returns 0 for success, -ECONNABORTED when the connection already closed and -EBUSY when sending data is not permitted in this state or LLC has send an I pdu with p bit set to 1 and is waiting for it's response.  */
int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
/* This function is called when upper layer wants to send data using connection oriented communication mode. During sending data, connection will be locked and received frames and expired timers will be queued. Returns 0 for success, -ECONNABORTED when the connection already closed and -EBUSY when sending data is not permitted in this state or LLC has send an I pdu with p bit set to 1 and is waiting for it's response.  */
int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
{
	struct llc_conn_state_ev *ev;
	int rc = -ECONNABORTED;
	struct llc_sock *llc = llc_sk(sk);
	if (unlikely(llc->state == LLC_CONN_STATE_ADM))
		goto out;
	rc = -EBUSY;
	if (unlikely(llc_data_accept_state(llc->state) ||
		     llc->p_flag)) {
		llc->failed_data_req = 1;
		goto out;
	}
	ev = llc_conn_ev(skb);
	ev->type      = LLC_CONN_EV_TYPE_PRIM;
	ev->prim      = LLC_DATA_PRIM;
	ev->prim_type = LLC_PRIM_TYPE_REQ;
	skb->dev      = llc->dev;
	rc = llc_conn_state_process(sk, skb);
out:
	return rc;
}