ia64/linux-2.6.18-xen.hg

view net/llc/llc_s_ev.c @ 673:3161879fdf22

[IA64] xencomm: support XENMEM_add_to_physmap and XENMEM_remove_from_phsymap

support XENMEM_add_to_physmap and XENMEM_remove_from_phsymap.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Tue Sep 16 21:26:15 2008 +0900 (2008-09-16)
parents 831230e53067
children
line source
1 /*
2 * llc_s_ev.c - Defines SAP component events
3 *
4 * The followed event functions are SAP component events which are described
5 * in 802.2 LLC protocol standard document.
6 *
7 * Copyright (c) 1997 by Procom Technology, Inc.
8 * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
9 *
10 * This program can be redistributed or modified under the terms of the
11 * GNU General Public License as published by the Free Software Foundation.
12 * This program is distributed without any warranty or implied warranty
13 * of merchantability or fitness for a particular purpose.
14 *
15 * See the GNU General Public License for more details.
16 */
17 #include <linux/socket.h>
18 #include <net/sock.h>
19 #include <net/llc_if.h>
20 #include <net/llc_s_ev.h>
21 #include <net/llc_pdu.h>
23 int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb)
24 {
25 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
27 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
28 ev->prim_type == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1;
29 }
31 int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb)
32 {
33 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
34 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
36 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
37 LLC_PDU_TYPE_IS_U(pdu) &&
38 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_UI ? 0 : 1;
39 }
41 int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb)
42 {
43 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
45 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
46 ev->prim == LLC_DATAUNIT_PRIM &&
47 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
49 }
51 int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb)
52 {
53 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
55 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
56 ev->prim == LLC_XID_PRIM &&
57 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
58 }
60 int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb)
61 {
62 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
63 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
65 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
66 LLC_PDU_TYPE_IS_U(pdu) &&
67 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1;
68 }
70 int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb)
71 {
72 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
73 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
75 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) &&
76 LLC_PDU_TYPE_IS_U(pdu) &&
77 LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_XID ? 0 : 1;
78 }
80 int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb)
81 {
82 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
84 return ev->type == LLC_SAP_EV_TYPE_PRIM &&
85 ev->prim == LLC_TEST_PRIM &&
86 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
87 }
89 int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb)
90 {
91 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
92 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
94 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_CMD(pdu) &&
95 LLC_PDU_TYPE_IS_U(pdu) &&
96 LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1;
97 }
99 int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb)
100 {
101 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
102 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
104 return ev->type == LLC_SAP_EV_TYPE_PDU && LLC_PDU_IS_RSP(pdu) &&
105 LLC_PDU_TYPE_IS_U(pdu) &&
106 LLC_U_PDU_RSP(pdu) == LLC_1_PDU_CMD_TEST ? 0 : 1;
107 }
109 int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb)
110 {
111 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
113 return ev->type == LLC_SAP_EV_TYPE_SIMPLE &&
114 ev->prim_type == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1;
115 }