Lines Matching +full:save +full:- +full:mac +full:- +full:address

2  * llc_sap.c - driver routines for SAP component.
5 * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
39 * llc_alloc_frame - allocates sk_buff for frame
54 hlen += llc_mac_header_len(dev->type); in llc_alloc_frame()
62 skb->protocol = htons(ETH_P_802_2); in llc_alloc_frame()
63 skb->dev = dev; in llc_alloc_frame()
74 /* save primitive for use by the user. */ in llc_save_primitive()
78 addr->sllc_family = sk->sk_family; in llc_save_primitive()
79 addr->sllc_arphrd = skb->dev->type; in llc_save_primitive()
80 addr->sllc_test = prim == LLC_TEST_PRIM; in llc_save_primitive()
81 addr->sllc_xid = prim == LLC_XID_PRIM; in llc_save_primitive()
82 addr->sllc_ua = prim == LLC_DATAUNIT_PRIM; in llc_save_primitive()
83 llc_pdu_decode_sa(skb, addr->sllc_mac); in llc_save_primitive()
84 llc_pdu_decode_ssap(skb, &addr->sllc_sap); in llc_save_primitive()
88 * llc_sap_rtn_pdu - Informs upper layer on rx of an UI, XID or TEST pdu.
99 ev->prim = LLC_TEST_PRIM; break; in llc_sap_rtn_pdu()
101 ev->prim = LLC_XID_PRIM; break; in llc_sap_rtn_pdu()
103 ev->prim = LLC_DATAUNIT_PRIM; break; in llc_sap_rtn_pdu()
105 ev->ind_cfm_flag = LLC_IND; in llc_sap_rtn_pdu()
109 * llc_find_sap_trans - finds transition for event
123 struct llc_sap_state *curr_state = &llc_sap_state_table[sap->state - 1]; in llc_find_sap_trans()
128 for (next_trans = curr_state->transitions; next_trans[i]->ev; i++) in llc_find_sap_trans()
129 if (!next_trans[i]->ev(sap, skb)) { in llc_find_sap_trans()
137 * llc_exec_sap_trans_actions - execute actions related to event
150 const llc_sap_action_t *next_action = trans->ev_actions; in llc_exec_sap_trans_actions()
159 * llc_sap_next_state - finds transition, execs actions & change SAP state
172 if (sap->state > LLC_NR_SAP_STATES) in llc_sap_next_state()
188 sap->state = trans->next_state; in llc_sap_next_state()
194 * llc_sap_state_process - sends event to SAP state machine
208 ev->ind_cfm_flag = 0; in llc_sap_state_process()
211 if (ev->ind_cfm_flag == LLC_IND && skb->sk->sk_state != TCP_LISTEN) { in llc_sap_state_process()
212 llc_save_primitive(skb->sk, skb, ev->prim); in llc_sap_state_process()
215 if (sock_queue_rcv_skb(skb->sk, skb) == 0) in llc_sap_state_process()
222 * llc_build_and_send_test_pkt - TEST interface for upper layers.
225 * @dmac: destination mac address
236 ev->saddr.lsap = sap->laddr.lsap; in llc_build_and_send_test_pkt()
237 ev->daddr.lsap = dsap; in llc_build_and_send_test_pkt()
238 memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); in llc_build_and_send_test_pkt()
239 memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); in llc_build_and_send_test_pkt()
241 ev->type = LLC_SAP_EV_TYPE_PRIM; in llc_build_and_send_test_pkt()
242 ev->prim = LLC_TEST_PRIM; in llc_build_and_send_test_pkt()
243 ev->prim_type = LLC_PRIM_TYPE_REQ; in llc_build_and_send_test_pkt()
248 * llc_build_and_send_xid_pkt - XID interface for upper layers
251 * @dmac: destination mac address
262 ev->saddr.lsap = sap->laddr.lsap; in llc_build_and_send_xid_pkt()
263 ev->daddr.lsap = dsap; in llc_build_and_send_xid_pkt()
264 memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); in llc_build_and_send_xid_pkt()
265 memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); in llc_build_and_send_xid_pkt()
267 ev->type = LLC_SAP_EV_TYPE_PRIM; in llc_build_and_send_xid_pkt()
268 ev->prim = LLC_XID_PRIM; in llc_build_and_send_xid_pkt()
269 ev->prim_type = LLC_PRIM_TYPE_REQ; in llc_build_and_send_xid_pkt()
274 * llc_sap_rcv - sends received pdus to the sap state machine
286 ev->type = LLC_SAP_EV_TYPE_PDU; in llc_sap_rcv()
287 ev->reason = 0; in llc_sap_rcv()
290 skb->sk = sk; in llc_sap_rcv()
291 skb->destructor = sock_efree; in llc_sap_rcv()
302 return sk->sk_type == SOCK_DGRAM && in llc_dgram_match()
304 llc->laddr.lsap == laddr->lsap && in llc_dgram_match()
305 ether_addr_equal(llc->laddr.mac, laddr->mac); in llc_dgram_match()
309 * llc_lookup_dgram - Finds dgram socket for the local sap/mac
311 * @laddr: address of local LLC (MAC + SAP)
315 * mac, and local sap. Returns pointer for socket found, %NULL otherwise.
324 struct hlist_nulls_head *laddr_hb = &sap->sk_laddr_hash[slot]; in llc_lookup_dgram()
331 if (unlikely(!refcount_inc_not_zero(&rc->sk_refcnt))) in llc_lookup_dgram()
333 if (unlikely(llc_sk(rc)->sap != sap || in llc_lookup_dgram()
361 return sk->sk_type == SOCK_DGRAM && in llc_mcast_match()
362 llc->laddr.lsap == laddr->lsap && in llc_mcast_match()
363 llc->dev == skb->dev; in llc_mcast_match()
385 * llc_sap_mcast - Deliver multicast PDU's to all matching datagram sockets.
387 * @laddr: address of local LLC (MAC + SAP)
401 struct hlist_head *dev_hb = llc_sk_dev_hash(sap, skb->dev->ifindex); in llc_sap_mcast()
403 spin_lock_bh(&sap->sk_lock); in llc_sap_mcast()
406 sk = &llc->sk; in llc_sap_mcast()
419 spin_unlock_bh(&sap->sk_lock); in llc_sap_mcast()
429 llc_pdu_decode_da(skb, laddr.mac); in llc_sap_handler()
432 if (is_multicast_ether_addr(laddr.mac)) { in llc_sap_handler()
436 struct sock *sk = llc_lookup_dgram(sap, &laddr, dev_net(skb->dev)); in llc_sap_handler()