Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* SCTP kernel implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * (C) Copyright IBM Corp. 2001, 2004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 1999-2000 Cisco, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 1999-2001 Motorola, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (c) 2001 Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * This file is part of the SCTP kernel implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * This file converts numerical ID value to alphabetical names for SCTP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * terms such as chunk type, parameter time, event type, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * Please send any bug reports or fixes you make to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * email address(es):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *    lksctp developers <linux-sctp@vger.kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * Written or modified by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *    La Monte H.P. Yarroll <piggy@acm.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *    Karl Knutson          <karl@athena.chicago.il.us>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *    Xingang Guo           <xingang.guo@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *    Jon Grimm             <jgrimm@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *    Daisy Chang	    <daisyc@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *    Sridhar Samudrala	    <sri@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <net/sctp/sctp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) /* These are printable forms of Chunk ID's from section 3.1.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	"DATA",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	"INIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	"INIT_ACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	"SACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	"HEARTBEAT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	"HEARTBEAT_ACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	"ABORT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	"SHUTDOWN",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	"SHUTDOWN_ACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	"ERROR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	"COOKIE_ECHO",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	"COOKIE_ACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	"ECN_ECNE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	"ECN_CWR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	"SHUTDOWN_COMPLETE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /* Lookup "chunk type" debug name. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) const char *sctp_cname(const union sctp_subtype cid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	if (cid.chunk <= SCTP_CID_BASE_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		return sctp_cid_tbl[cid.chunk];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	switch (cid.chunk) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	case SCTP_CID_ASCONF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		return "ASCONF";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	case SCTP_CID_ASCONF_ACK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		return "ASCONF_ACK";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	case SCTP_CID_FWD_TSN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		return "FWD_TSN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	case SCTP_CID_AUTH:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		return "AUTH";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	case SCTP_CID_RECONF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		return "RECONF";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	case SCTP_CID_I_DATA:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		return "I_DATA";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	case SCTP_CID_I_FWD_TSN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		return "I_FWD_TSN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	return "unknown chunk";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) /* These are printable forms of the states.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) const char *const sctp_state_tbl[SCTP_STATE_NUM_STATES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	"STATE_CLOSED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	"STATE_COOKIE_WAIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	"STATE_COOKIE_ECHOED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	"STATE_ESTABLISHED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	"STATE_SHUTDOWN_PENDING",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	"STATE_SHUTDOWN_SENT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	"STATE_SHUTDOWN_RECEIVED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	"STATE_SHUTDOWN_ACK_SENT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) /* Events that could change the state of an association.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) const char *const sctp_evttype_tbl[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	"EVENT_T_unknown",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	"EVENT_T_CHUNK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	"EVENT_T_TIMEOUT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	"EVENT_T_OTHER",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	"EVENT_T_PRIMITIVE"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* Return value of a state function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) const char *const sctp_status_tbl[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	"DISPOSITION_DISCARD",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	"DISPOSITION_CONSUME",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	"DISPOSITION_NOMEM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	"DISPOSITION_DELETE_TCB",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	"DISPOSITION_ABORT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	"DISPOSITION_VIOLATION",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	"DISPOSITION_NOT_IMPL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	"DISPOSITION_ERROR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	"DISPOSITION_BUG"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Printable forms of primitives */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static const char *const sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	"PRIMITIVE_ASSOCIATE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	"PRIMITIVE_SHUTDOWN",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	"PRIMITIVE_ABORT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	"PRIMITIVE_SEND",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	"PRIMITIVE_REQUESTHEARTBEAT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	"PRIMITIVE_ASCONF",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* Lookup primitive debug name. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) const char *sctp_pname(const union sctp_subtype id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		return sctp_primitive_tbl[id.primitive];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	return "unknown_primitive";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static const char *const sctp_other_tbl[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	"NO_PENDING_TSN",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	"ICMP_PROTO_UNREACH",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /* Lookup "other" debug name. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) const char *sctp_oname(const union sctp_subtype id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	if (id.other <= SCTP_EVENT_OTHER_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		return sctp_other_tbl[id.other];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	return "unknown 'other' event";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static const char *const sctp_timer_tbl[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	"TIMEOUT_NONE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	"TIMEOUT_T1_COOKIE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	"TIMEOUT_T1_INIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	"TIMEOUT_T2_SHUTDOWN",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	"TIMEOUT_T3_RTX",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	"TIMEOUT_T4_RTO",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	"TIMEOUT_T5_SHUTDOWN_GUARD",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	"TIMEOUT_HEARTBEAT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	"TIMEOUT_RECONF",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	"TIMEOUT_SACK",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	"TIMEOUT_AUTOCLOSE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /* Lookup timer debug name. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) const char *sctp_tname(const union sctp_subtype id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	BUILD_BUG_ON(SCTP_EVENT_TIMEOUT_MAX + 1 != ARRAY_SIZE(sctp_timer_tbl));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		return sctp_timer_tbl[id.timeout];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	return "unknown_timer";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }