hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/net/sctp/ulpevent.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /* SCTP kernel implementation
23 * (C) Copyright IBM Corp. 2001, 2004
34 * Copyright (c) 1999-2000 Cisco, Inc.
....@@ -11,22 +12,6 @@
1112 * upwards to the ULP.
1213 *
1314 * This file is part of the SCTP kernel implementation
14
- *
15
- * This SCTP implementation is free software;
16
- * you can redistribute it and/or modify it under the terms of
17
- * the GNU General Public License as published by
18
- * the Free Software Foundation; either version 2, or (at your option)
19
- * any later version.
20
- *
21
- * This SCTP implementation is distributed in the hope that it
22
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
23
- * ************************
24
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25
- * See the GNU General Public License for more details.
26
- *
27
- * You should have received a copy of the GNU General Public License
28
- * along with GNU CC; see the file COPYING. If not, see
29
- * <http://www.gnu.org/licenses/>.
3015 *
3116 * Please send any bug reports or fixes you make to the
3217 * email address(es):
....@@ -95,13 +80,8 @@
9580 struct sctp_chunk *chunk,
9681 gfp_t gfp);
9782
98
-struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
99
- const struct sctp_association *asoc,
100
- const struct sockaddr_storage *aaddr,
101
- int flags,
102
- int state,
103
- int error,
104
- gfp_t gfp);
83
+void sctp_ulpevent_notify_peer_addr_change(struct sctp_transport *transport,
84
+ int state, int error);
10585
10686 struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
10787 const struct sctp_association *asoc,
....@@ -109,6 +89,13 @@
10989 __u16 flags,
11090 gfp_t gfp);
11191 struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
92
+ const struct sctp_association *asoc,
93
+ struct sctp_chunk *chunk,
94
+ __u16 flags,
95
+ __u32 error,
96
+ gfp_t gfp);
97
+
98
+struct sctp_ulpevent *sctp_ulpevent_make_send_failed_event(
11299 const struct sctp_association *asoc,
113100 struct sctp_chunk *chunk,
114101 __u16 flags,
....@@ -164,30 +151,39 @@
164151
165152 __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
166153
167
-/* Is this event type enabled? */
168
-static inline int sctp_ulpevent_type_enabled(__u16 sn_type,
169
- struct sctp_event_subscribe *mask)
154
+static inline void sctp_ulpevent_type_set(__u16 *subscribe,
155
+ __u16 sn_type, __u8 on)
170156 {
171
- int offset = sn_type - SCTP_SN_TYPE_BASE;
172
- char *amask = (char *) mask;
157
+ if (sn_type > SCTP_SN_TYPE_MAX)
158
+ return;
173159
174
- if (offset >= sizeof(struct sctp_event_subscribe))
175
- return 0;
176
- return amask[offset];
160
+ if (on)
161
+ *subscribe |= (1 << (sn_type - SCTP_SN_TYPE_BASE));
162
+ else
163
+ *subscribe &= ~(1 << (sn_type - SCTP_SN_TYPE_BASE));
164
+}
165
+
166
+/* Is this event type enabled? */
167
+static inline bool sctp_ulpevent_type_enabled(__u16 subscribe, __u16 sn_type)
168
+{
169
+ if (sn_type > SCTP_SN_TYPE_MAX)
170
+ return false;
171
+
172
+ return subscribe & (1 << (sn_type - SCTP_SN_TYPE_BASE));
177173 }
178174
179175 /* Given an event subscription, is this event enabled? */
180
-static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
181
- struct sctp_event_subscribe *mask)
176
+static inline bool sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
177
+ __u16 subscribe)
182178 {
183179 __u16 sn_type;
184
- int enabled = 1;
185180
186
- if (sctp_ulpevent_is_notification(event)) {
187
- sn_type = sctp_ulpevent_get_notification_type(event);
188
- enabled = sctp_ulpevent_type_enabled(sn_type, mask);
189
- }
190
- return enabled;
181
+ if (!sctp_ulpevent_is_notification(event))
182
+ return true;
183
+
184
+ sn_type = sctp_ulpevent_get_notification_type(event);
185
+
186
+ return sctp_ulpevent_type_enabled(subscribe, sn_type);
191187 }
192188
193189 #endif /* __sctp_ulpevent_h__ */