Loading...
Searching...
No Matches
gprs_bssgp.c File Reference

GPRS BSSGP protocol implementation as per 3GPP TS 08.18. More...

`#include <errno.h>`
`#include <stdint.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/byteswap.h>`
`#include <osmocom/core/bit16gen.h>`
`#include <osmocom/gsm/tlv.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/core/rate_ctr.h>`
`#include <osmocom/core/stats.h>`
`#include <osmocom/gprs/gprs_bssgp.h>`
`#include <osmocom/gprs/gprs_bssgp_bss.h>`
`#include <osmocom/gprs/gprs_ns.h>`
`#include "osmocom/gsm/gsm48.h"`
`#include "gprs_bssgp_internal.h"`

## Data Structures

struct | bssgp_fc_queue_element

## Functions

static int | _gprs_ns_sendmsg (void *ctx, struct msgb *msg)
| LLIST_HEAD (bssgp_bvc_ctxts)
static int | _bssgp_tx_dl_ud (struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv)
struct bssgp_bvc_ctx * | btsctx_by_raid_cid (const struct gprs_ra_id *raid, uint16_t cid)
static int | tx_bvc_reset_nsei_bvci (enum bssgp_pdu_type pdu, uint16_t nsei, uint16_t bvci, enum gprs_bssgp_cause cause, const struct gprs_ra_id *ra_id, uint16_t cell_id)
int | bssgp_tx_bvc_reset_nsei_bvci (uint16_t nsei, uint16_t bvci, enum gprs_bssgp_cause cause, const struct gprs_ra_id *ra_id, uint16_t cell_id)
| Transmit a BVC-RESET message with a given nsei and bvci (Chapter 10.4.12)
int | bssgp_tx_bvc_reset_ack_nsei_bvci (uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id)
| Transmit a BVC-RESET-ACK message with a given nsei and bvci (Chapter 10.4.12)
int | bssgp_tx_bvc_ptp_reset (uint16_t nsei, enum gprs_bssgp_cause cause)
| Initiate reset procedure for all PTP BVC on a given NSEI.
struct bssgp_bvc_ctx * | btsctx_by_bvci_nsei (uint16_t bvci, uint16_t nsei)
void | bssgp_set_bssgp_callback (bssgp_bvc_send ns_send, void *data)
struct bssgp_bvc_ctx * | btsctx_alloc (uint16_t bvci, uint16_t nsei)
void | bssgp_bvc_ctx_free (struct bssgp_bvc_ctx *ctx)
static int | bssgp_tx_fc_bvc_ack (uint16_t nsei, uint8_t tag, uint16_t ns_bvci)
int | bssgp_tx_suspend_ack (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id, uint8_t suspend_ref)
int | bssgp_tx_suspend_nack (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id, uint8_t *cause)
int | bssgp_tx_resume_ack (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id)
int | bssgp_tx_resume_nack (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id, uint8_t *cause)
uint16_t | bssgp_parse_cell_id (struct gprs_ra_id *raid, const uint8_t *buf)
int | bssgp_parse_cell_id2 (struct osmo_routing_area_id *raid, uint16_t *cid, const uint8_t *buf, size_t buf_len)
| Parse the value of a BSSGP Cell identity (04.08 RAI + Cell Id)
int | bssgp_create_cell_id (uint8_t *buf, const struct gprs_ra_id *raid, uint16_t cid)
int | bssgp_create_cell_id2 (uint8_t *buf, size_t buf_len, const struct osmo_routing_area_id *raid, const uint16_t cid)
| Encode the 04.08 RAI, Cell Id into BSSGP Cell identity.
static int | bssgp_rx_bvc_reset (struct msgb *msg, struct tlv_parsed *tp, uint16_t ns_bvci)
static int | bssgp_rx_bvc_block (struct msgb *msg, struct tlv_parsed *tp)
static int | bssgp_rx_bvc_unblock (struct msgb *msg, struct tlv_parsed *tp)
static int | bssgp_rx_ul_ud (struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *ctx)
static int | bssgp_rx_suspend (struct msgb *msg, struct tlv_parsed *tp)
static int | bssgp_rx_resume (struct msgb *msg, struct tlv_parsed *tp)
static int | bssgp_rx_llc_disc (struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *ctx)
int | bssgp_rx_status (struct msgb *msg, struct tlv_parsed *tp, uint16_t bvci, struct bssgp_bvc_ctx *bctx)
static int | fc_queue_timer_cfg (struct bssgp_flow_control *fc)
static int | bssgp_fc_needs_queueing (struct bssgp_flow_control *fc, uint32_t pdu_len)
static void | fc_timer_cb (void *data)
static int | fc_enqueue (struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv)
int | bssgp_fc_in (struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv)
void | bssgp_fc_init (struct bssgp_flow_control *fc, uint32_t bucket_size_max, uint32_t bucket_leak_rate, uint32_t max_queue_depth, int(*out_cb)(struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv))
int | bssgp_fc_ms_init (struct bssgp_flow_control *fc_ms, uint16_t bvci, uint16_t nsei, uint32_t max_queue_depth)
static int | bssgp_rx_fc_bvc (struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx)
static int | bssgp_rx_ptp (struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx)
static int | bssgp_rx_sign (struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx)
int | bssgp_rcvmsg (struct msgb *msg)
int | bssgp_tx_dl_ud (struct msgb *msg, uint16_t pdu_lifetime, struct bssgp_dl_ud_par *dup)
int | bssgp_tx_paging (uint16_t nsei, uint16_t ns_bvci, struct bssgp_paging_info *pinfo)
void | bssgp_set_log_ss (int ss)
void | bssgp_fc_flush_queue (struct bssgp_flow_control *fc)
| Flush the queue of the bssgp_flow_control.
void | bssgp_flush_all_queues (void)
| Flush the queues of all BSSGP contexts.

## Variables

void * | bssgp_tall_ctx = NULL
bssgp_bvc_send | bssgp_ns_send = _gprs_ns_sendmsg
void * | bssgp_ns_send_data = NULL
static const struct rate_ctr_desc | bssgp_ctr_description []
static const struct rate_ctr_group_desc | bssgp_ctrg_desc

## Detailed Description

GPRS BSSGP protocol implementation as per 3GPP TS 08.18.

GPRS BSSGP RIM protocol implementation as per 3GPP TS 48.018.

## Function Documentation

## _bssgp_tx_dl_ud()

static int _bssgp_tx_dl_ud | ( | struct bssgp_flow_control * | fc,
|  | struct msgb * | msg,
|  | uint32_t | llc_pdu_len,
|  | void * | priv
| ) |  |

static

References bssgp_ns_send, bssgp_ns_send_data, and msg.

Referenced by btsctx_alloc().

## _gprs_ns_sendmsg()

static int _gprs_ns_sendmsg | ( | void * | ctx,
|  | struct msgb * | msg
| ) |  |

static

References bssgp_nsi, gprs_ns_sendmsg(), msg, and OSMO_ASSERT.

## bssgp_bvc_ctx_free()

void bssgp_bvc_ctx_free | ( | struct bssgp_bvc_ctx * | ctx | ) |

References bssgp_bvc_ctx::ctrg, bssgp_bvc_ctx::fc, bssgp_bvc_ctx::list, osmo_timer_del(), rate_ctr_group_free(), and bssgp_flow_control::timer.

## bssgp_create_cell_id()

int bssgp_create_cell_id | ( | uint8_t * | buf,
|  | const struct gprs_ra_id * | raid,
|  | uint16_t | cid
| ) |  |

References gsm48_encode_ra().

Referenced by bssgp2_enc_bvc_reset(), bssgp2_enc_bvc_reset_ack(), bssgp_create_rim_ri(), bssgp_enc_ran_inf_app_cont_nacc(), bssgp_enc_ran_inf_req_app_cont_nacc(), bssgp_tx_ul_ud(), and tx_bvc_reset_nsei_bvci().

## bssgp_create_cell_id2()

int bssgp_create_cell_id2 | ( | uint8_t * | buf,
|  | size_t | buf_len,
|  | const struct osmo_routing_area_id * | raid,
|  | const uint16_t | cid
| ) |  |

Encode the 04.08 RAI, Cell Id into BSSGP Cell identity.

References osmo_routing_area_id_encode_buf().

## bssgp_fc_flush_queue()

void bssgp_fc_flush_queue | ( | struct bssgp_flow_control * | fc | ) |

Flush the queue of the bssgp_flow_control.

Parameters

  [in] | The | flow control object which holds the queue.

References bssgp_fc_queue_element::list, llist_for_each_entry_safe, bssgp_fc_queue_element::msg, msgb_free(), and bssgp_flow_control::queue.

Referenced by bssgp_flush_all_queues().

## bssgp_fc_in()

int bssgp_fc_in | ( | struct bssgp_flow_control * | fc,
|  | struct msgb * | msg,
|  | uint32_t | llc_pdu_len,
|  | void * | priv
| ) |  |

References bssgp_fc_needs_queueing(), bssgp_flow_control::bucket_size_max, DLBSSGP, fc_enqueue(), LOGL_NOTICE, LOGP, msg, msgb_free(), osmo_gettimeofday(), bssgp_flow_control::out_cb, and bssgp_flow_control::time_last_pdu.

Referenced by bssgp_fc_ms_init(), and bssgp_tx_dl_ud().

## bssgp_fc_init()

void bssgp_fc_init | ( | struct bssgp_flow_control * | fc,
|  | uint32_t | bucket_size_max,
|  | uint32_t | bucket_leak_rate,
|  | uint32_t | max_queue_depth,
|  | int(*)(struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv) | out_cb
| ) |  |

References bssgp_flow_control::bucket_leak_rate, bssgp_flow_control::bucket_size_max, INIT_LLIST_HEAD, bssgp_flow_control::max_queue_depth, osmo_gettimeofday(), bssgp_flow_control::out_cb, bssgp_flow_control::queue, and bssgp_flow_control::time_last_pdu.

Referenced by bssgp_fc_ms_init(), and btsctx_alloc().

## bssgp_fc_ms_init()

int bssgp_fc_ms_init | ( | struct bssgp_flow_control * | fc_ms,
|  | uint16_t | bvci,
|  | uint16_t | nsei,
|  | uint32_t | max_queue_depth
| ) |  |

References bssgp_bvc_ctx::bmax_default_ms, bssgp_fc_in(), bssgp_fc_init(), btsctx_by_bvci_nsei(), bvci, nsei, and bssgp_bvc_ctx::r_default_ms.

## bssgp_fc_needs_queueing()

static int bssgp_fc_needs_queueing | ( | struct bssgp_flow_control * | fc,
|  | uint32_t | pdu_len
| ) |  |

static

References bssgp_flow_control::bucket_counter, bssgp_flow_control::bucket_leak_rate, osmo_gettimeofday(), bssgp_flow_control::time_last_pdu, and timersub.

Referenced by bssgp_fc_in(), and fc_timer_cb().

## bssgp_flush_all_queues()

void bssgp_flush_all_queues | ( | void |  | ) |

Flush the queues of all BSSGP contexts.

References bssgp_bvc_ctxts, bssgp_fc_flush_queue(), bssgp_bvc_ctx::fc, bssgp_bvc_ctx::list, and llist_for_each_entry.

## bssgp_parse_cell_id()

uint16_t bssgp_parse_cell_id | ( | struct gprs_ra_id * | raid,
|  | const uint8_t * | buf
| ) |  |

References gsm48_parse_ra().

Referenced by bssgp_bvc_fsm_allstate(), bssgp_bvc_fsm_wait_reset_ack(), bssgp_parse_rim_ra(), and bssgp_rx_bvc_reset().

## bssgp_parse_cell_id2()

int bssgp_parse_cell_id2 | ( | struct osmo_routing_area_id * | raid,
|  | uint16_t * | cid,
|  | const uint8_t * | buf,
|  | size_t | buf_len
| ) |  |

Parse the value of a BSSGP Cell identity (04.08 RAI + Cell Id)

References osmo_routing_area_id_decode().

## bssgp_rcvmsg()

int bssgp_rcvmsg | ( | struct msgb * | msg | ) |

References BSSGP_CAUSE_INV_MAND_INF, BSSGP_CAUSE_PDU_INCOMP_FEAT, BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_CTR_BYTES_IN, BSSGP_CTR_PKTS_IN, BSSGP_IE_BVCI, bssgp_pdu_str(), BSSGP_PDUT_BVC_RESET, BSSGP_PDUT_DL_UNITDATA, BSSGP_PDUT_STATUS, BSSGP_PDUT_UL_UNITDATA, bssgp_rx_ptp(), bssgp_rx_sign(), bssgp_rx_status(), bssgp_tlv_parse(), bssgp_tx_status(), btsctx_by_bvci_nsei(), bvci, BVCI_PTM, BVCI_SIGNALLING, bssgp_bvc_ctx::ctrg, bssgp_ud_hdr::data, bssgp_normal_hdr::data, DLBSSGP, LOG_CTX_GB_BVC, log_set_context(), LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_bssgp_len, msgb_bssgph, msgb_bvci, msgb_hexdump(), msgb_nsei, nsei, pdu_type, bssgp_normal_hdr::pdu_type, rate_ctr_add(), rate_ctr_group_get_ctr(), and TLVP_PRES_LEN.

## bssgp_rx_bvc_block()

static int bssgp_rx_bvc_block | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp
| ) |  |

static

References BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_CTR_BLOCKED, BSSGP_IE_BVCI, BSSGP_PDUT_BVC_BLOCK_ACK, bssgp_prim_cb(), bssgp_tx_simple_bvci(), bssgp_tx_status(), btsctx_by_bvci_nsei(), BVC_S_BLOCKED, osmo_bssgp_prim::bvci, bvci, BVCI_SIGNALLING, bssgp_bvc_ctx::ctrg, DLBSSGP, LOGL_ERROR, LOGL_INFO, LOGP, msg, msgb_bvci, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_NM_BVC_BLOCK, PRIM_OP_INDICATION, rate_ctr_group_get_ctr(), SAP_BSSGP_NM, bssgp_bvc_ctx::state, and osmo_bssgp_prim::tp.

Referenced by bssgp_rx_sign().

## bssgp_rx_bvc_reset()

static int bssgp_rx_bvc_reset | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | uint16_t | ns_bvci
| ) |  |

static

References bssgp_cause_str(), BSSGP_IE_BVCI, BSSGP_IE_CAUSE, BSSGP_IE_CELL_ID, bssgp_parse_cell_id(), BSSGP_PDUT_BVC_RESET_ACK, bssgp_prim_cb(), bssgp_tx_bvc_reset_ack_nsei_bvci(), bssgp_tx_simple_bvci(), btsctx_alloc(), btsctx_by_bvci_nsei(), osmo_bssgp_prim::bvci, bvci, BVCI_PTM, BVCI_SIGNALLING, bssgp_bvc_ctx::cell_id, DEBUGP, DLBSSGP, bssgp_bvc_ctx::is_sgsn, LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, osmo_rai_name(), PRIM_NM_BVC_RESET, PRIM_OP_INDICATION, osmo_bssgp_prim::ra_id, bssgp_bvc_ctx::ra_id, SAP_BSSGP_NM, bssgp_bvc_ctx::state, TLVP_PRES_LEN, TLVP_VAL, and osmo_bssgp_prim::tp.

Referenced by bssgp_rx_ptp(), and bssgp_rx_sign().

## bssgp_rx_bvc_unblock()

static int bssgp_rx_bvc_unblock | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp
| ) |  |

static

References BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_IE_BVCI, BSSGP_PDUT_BVC_UNBLOCK_ACK, bssgp_prim_cb(), bssgp_tx_simple_bvci(), bssgp_tx_status(), btsctx_by_bvci_nsei(), osmo_bssgp_prim::bvci, bvci, BVCI_SIGNALLING, DEBUGP, DLBSSGP, LOGL_ERROR, LOGP, msg, msgb_bvci, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_NM_BVC_UNBLOCK, PRIM_OP_INDICATION, SAP_BSSGP_NM, bssgp_bvc_ctx::state, and osmo_bssgp_prim::tp.

Referenced by bssgp_rx_sign().

## bssgp_rx_fc_bvc()

static int bssgp_rx_fc_bvc | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | struct bssgp_bvc_ctx * | bctx
| ) |  |

static

References bssgp_bvc_ctx::bmax_default_ms, BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_IE_BMAX_DEFAULT_MS, BSSGP_IE_BUCKET_LEAK_RATE, BSSGP_IE_BVC_BUCKET_SIZE, BSSGP_IE_R_DEFAULT_MS, BSSGP_IE_TAG, bssgp_tx_fc_bvc_ack(), bssgp_tx_status(), bssgp_flow_control::bucket_leak_rate, bssgp_flow_control::bucket_size_max, bssgp_bvc_ctx::bvci, DEBUGP, DLBSSGP, bssgp_bvc_ctx::fc, fc_queue_timer_cfg(), LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, bssgp_bvc_ctx::r_default_ms, TLVP_PRES_LEN, and TLVP_VAL.

Referenced by bssgp_rx_ptp().

## bssgp_rx_llc_disc()

static int bssgp_rx_llc_disc | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | struct bssgp_bvc_ctx * | ctx
| ) |  |

static

References BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_CTR_DISCARDED, BSSGP_IE_BVCI, BSSGP_IE_LLC_FRAMES_DISCARDED, BSSGP_IE_NUM_OCT_AFF, BSSGP_IE_TLLI, bssgp_prim_cb(), bssgp_tx_status(), osmo_bssgp_prim::bvci, bssgp_bvc_ctx::bvci, bssgp_bvc_ctx::ctrg, DEBUGP, DLBSSGP, LOGL_ERROR, LOGP, msg, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_NM_LLC_DISCARDED, PRIM_OP_INDICATION, rate_ctr_group_get_ctr(), SAP_BSSGP_NM, osmo_bssgp_prim::tlli, TLVP_PRES_LEN, and osmo_bssgp_prim::tp.

Referenced by bssgp_rx_sign().

## bssgp_rx_ptp()

static int bssgp_rx_ptp | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | struct bssgp_bvc_ctx * | bctx
| ) |  |

static

References BSSGP_CAUSE_BVCI_BLOCKED, BSSGP_CAUSE_PDU_INCOMP_FEAT, BSSGP_CAUSE_PROTO_ERR_UNSPEC, bssgp_pdu_str(), BSSGP_PDUT_BVC_RESET, BSSGP_PDUT_CREATE_BSS_PFC_ACK, BSSGP_PDUT_CREATE_BSS_PFC_NACK, BSSGP_PDUT_DELETE_BSS_PFC_ACK, BSSGP_PDUT_DL_UNITDATA, BSSGP_PDUT_DOWNLOAD_BSS_PFC, BSSGP_PDUT_FLOW_CONTROL_BVC, BSSGP_PDUT_FLOW_CONTROL_BVC_ACK, BSSGP_PDUT_FLOW_CONTROL_MS, BSSGP_PDUT_FLOW_CONTROL_MS_ACK, BSSGP_PDUT_MODIFY_BSS_PFC, BSSGP_PDUT_PAGING_CS, BSSGP_PDUT_PAGING_PS, BSSGP_PDUT_RA_CAPA_UPDATE_ACK, BSSGP_PDUT_RA_CAPABILITY, BSSGP_PDUT_RADIO_STATUS, BSSGP_PDUT_STATUS, BSSGP_PDUT_UL_UNITDATA, bssgp_rx_bvc_reset(), bssgp_rx_fc_bvc(), bssgp_rx_ul_ud(), bssgp_tx_status(), BVC_S_BLOCKED, bssgp_bvc_ctx::bvci, bvci, DEBUGP, DLBSSGP, msg, msgb_bssgph, msgb_bvci, OSMO_ASSERT, pdu_type, bssgp_normal_hdr::pdu_type, and bssgp_bvc_ctx::state.

Referenced by bssgp_rcvmsg().

## bssgp_rx_resume()

static int bssgp_rx_resume | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp
| ) |  |

static

References BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_IE_ROUTEING_AREA, BSSGP_IE_SUSPEND_REF_NR, BSSGP_IE_TLLI, bssgp_prim_cb(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_status(), osmo_bssgp_prim::bvci, DEBUGP, DLBSSGP, gsm48_parse_ra(), LOGL_ERROR, LOGP, msg, msgb_bvci, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_BSSGP_GMM_RESUME, PRIM_OP_REQUEST, osmo_bssgp_prim::ra_id, osmo_bssgp_prim::resume, SAP_BSSGP_GMM, osmo_bssgp_prim::suspend_ref, tlli, osmo_bssgp_prim::tlli, TLVP_PRES_LEN, TLVP_VAL, and osmo_bssgp_prim::u.

Referenced by bssgp_rx_sign().

## bssgp_rx_sign()

static int bssgp_rx_sign | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | struct bssgp_bvc_ctx * | bctx
| ) |  |

static

References BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_CAUSE_PROTO_ERR_UNSPEC, BSSGP_IE_BVCI, BSSGP_IE_CAUSE, bssgp_pdu_str(), BSSGP_PDUT_BVC_BLOCK, BSSGP_PDUT_BVC_BLOCK_ACK, BSSGP_PDUT_BVC_RESET, BSSGP_PDUT_BVC_RESET_ACK, BSSGP_PDUT_BVC_UNBLOCK, BSSGP_PDUT_BVC_UNBLOCK_ACK, BSSGP_PDUT_FLUSH_LL, BSSGP_PDUT_FLUSH_LL_ACK, BSSGP_PDUT_LLC_DISCARD, BSSGP_PDUT_PAGING_CS, BSSGP_PDUT_PAGING_PS, BSSGP_PDUT_RAN_INFO, BSSGP_PDUT_RAN_INFO_ACK, BSSGP_PDUT_RAN_INFO_APP_ERROR, BSSGP_PDUT_RAN_INFO_ERROR, BSSGP_PDUT_RAN_INFO_REQ, BSSGP_PDUT_RESUME, BSSGP_PDUT_RESUME_ACK, BSSGP_PDUT_RESUME_NACK, BSSGP_PDUT_SGSN_INVOKE_TRACE, BSSGP_PDUT_STATUS, BSSGP_PDUT_SUSPEND, BSSGP_PDUT_SUSPEND_ACK, BSSGP_PDUT_SUSPEND_NACK, bssgp_rx_bvc_block(), bssgp_rx_bvc_reset(), bssgp_rx_bvc_unblock(), bssgp_rx_llc_disc(), bssgp_rx_resume(), bssgp_rx_rim(), bssgp_rx_suspend(), bssgp_tx_status(), bssgp_bvc_ctx::bvci, bvci, DEBUGP, DLBSSGP, LOGL_ERROR, LOGP, msg, msgb_bssgph, msgb_bvci, pdu_type, bssgp_normal_hdr::pdu_type, and TLVP_PRES_LEN.

Referenced by bssgp_rcvmsg().

## bssgp_rx_status()

int bssgp_rx_status | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | uint16_t | bvci,
|  | struct bssgp_bvc_ctx * | bctx
| ) |  |

References BSSGP_CAUSE_BVCI_BLOCKED, BSSGP_CAUSE_PROTO_ERR_UNSPEC, bssgp_cause_str(), BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_CTR_STATUS, BSSGP_IE_BVCI, BSSGP_IE_CAUSE, bssgp_prim_cb(), osmo_bssgp_prim::bvci, bvci, cause, bssgp_bvc_ctx::ctrg, DLBSSGP, LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_NM_STATUS, PRIM_OP_INDICATION, rate_ctr_group_get_ctr(), SAP_BSSGP_NM, TLVP_PRES_LEN, TLVP_VAL, and osmo_bssgp_prim::tp.

Referenced by bssgp_rcvmsg().

## bssgp_rx_suspend()

static int bssgp_rx_suspend | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp
| ) |  |

static

References BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_IE_ROUTEING_AREA, BSSGP_IE_TLLI, bssgp_prim_cb(), bssgp_tx_status(), bssgp_tx_suspend_ack(), bssgp_tx_suspend_nack(), osmo_bssgp_prim::bvci, DEBUGP, DLBSSGP, gsm48_parse_ra(), LOGL_ERROR, LOGP, msg, msgb_bvci, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, PRIM_BSSGP_GMM_SUSPEND, PRIM_OP_REQUEST, osmo_bssgp_prim::ra_id, SAP_BSSGP_GMM, tlli, osmo_bssgp_prim::tlli, TLVP_PRES_LEN, and TLVP_VAL.

Referenced by bssgp_rx_sign().

## bssgp_rx_ul_ud()

static int bssgp_rx_ul_ud | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | struct bssgp_bvc_ctx * | ctx
| ) |  |

static

References BSSGP_CAUSE_MISSING_MAND_IE, BSSGP_IE_CELL_ID, BSSGP_IE_LLC_PDU, bssgp_prim_cb(), bssgp_tx_status(), osmo_bssgp_prim::bvci, bssgp_bvc_ctx::bvci, DEBUGP, DLBSSGP, LOGL_ERROR, LOGP, msg, msgb_bcid, msgb_bssgph, msgb_llch, msgb_tlli, osmo_bssgp_prim::nsei, bssgp_bvc_ctx::nsei, osmo_bssgp_prim::oph, osmo_ntohl, PRIM_BSSGP_UL_UD, PRIM_OP_INDICATION, SAP_BSSGP_LL, osmo_bssgp_prim::tlli, bssgp_ud_hdr::tlli, TLVP_PRES_LEN, TLVP_PRESENT, TLVP_VAL, and osmo_bssgp_prim::tp.

Referenced by bssgp_rx_ptp().

## bssgp_set_bssgp_callback()

void bssgp_set_bssgp_callback | ( | bssgp_bvc_send | ns_send,
|  | void * | data
| ) |  |

References bssgp_ns_send, bssgp_ns_send_data, and data.

## bssgp_set_log_ss()

void bssgp_set_log_ss | ( | int | ss | ) |

## bssgp_tx_bvc_ptp_reset()

int bssgp_tx_bvc_ptp_reset | ( | uint16_t | nsei,
|  | enum gprs_bssgp_cause | cause
| ) |  |

Initiate reset procedure for all PTP BVC on a given NSEI.

This function initiates reset procedure for all PTP BVC with a given cause.

Parameters

  [in] | nsei | NSEI to which PTP BVC should belong to
  [in] | cause | Cause of BVC RESET

Returns
  0 on success, negative error code otherwise

References bssgp_bvc_ctxts, bssgp_cause_str(), bssgp_tx_bvc_reset(), bssgp_bvc_ctx::bvci, BVCI_SIGNALLING, cause, DLBSSGP, bssgp_bvc_ctx::list, llist_for_each_entry, LOGL_DEBUG, LOGP, bssgp_bvc_ctx::nsei, and nsei.

## bssgp_tx_bvc_reset_ack_nsei_bvci()

int bssgp_tx_bvc_reset_ack_nsei_bvci | ( | uint16_t | nsei,
|  | uint16_t | bvci,
|  | const struct gprs_ra_id * | ra_id,
|  | uint16_t | cell_id
| ) |  |

Transmit a BVC-RESET-ACK message with a given nsei and bvci (Chapter 10.4.12)

Parameters

  [in] | nsei | The NSEI to transmit over
  [in] | bvci | BVCI of the BVC to reset
  [in] | ra_id | Pointer to the ra_id to include. If NULL no cell information will be included
  [in] | cell_id | The cell_id to include (if ra_id is not NULL) returns >= 0 on success, on error < 0.

References BSSGP_PDUT_BVC_RESET_ACK, bvci, nsei, ra_id, and tx_bvc_reset_nsei_bvci().

Referenced by bssgp_rx_bvc_reset().

## bssgp_tx_bvc_reset_nsei_bvci()

int bssgp_tx_bvc_reset_nsei_bvci | ( | uint16_t | nsei,
|  | uint16_t | bvci,
|  | enum gprs_bssgp_cause | cause,
|  | const struct gprs_ra_id * | ra_id,
|  | uint16_t | cell_id
| ) |  |

Transmit a BVC-RESET message with a given nsei and bvci (Chapter 10.4.12)

Parameters

  [in] | nsei | The NSEI to transmit over
  [in] | bvci | BVCI of the BVC to reset
  [in] | cause | The cause of the reset
  [in] | ra_id | Pointer to the ra_id to include. If NULL no cell information will be included
  [in] | cell_id | The cell_id to include (if ra_id is not NULL) returns >= 0 on success, on error < 0.

References BSSGP_PDUT_BVC_RESET, bvci, cause, nsei, ra_id, and tx_bvc_reset_nsei_bvci().

Referenced by bssgp_tx_bvc_reset2().

## bssgp_tx_dl_ud()

int bssgp_tx_dl_ud | ( | struct msgb * | msg,
|  | uint16_t | pdu_lifetime,
|  | struct bssgp_dl_ud_par * | dup
| ) |  |

References BSSGP_CTR_BYTES_OUT, BSSGP_CTR_PKTS_OUT, bssgp_fc_in(), BSSGP_IE_DRX_PARAMS, BSSGP_IE_IMSI, BSSGP_IE_LLC_PDU, BSSGP_IE_MS_RADIO_ACCESS_CAP, BSSGP_IE_PDU_LIFETIME, BSSGP_IE_TLLI, BSSGP_PDUT_DL_UNITDATA, btsctx_by_bvci_nsei(), bvci, BVCI_PTM, bssgp_bvc_ctx::ctrg, DLBSSGP, bssgp_dl_ud_par::drx_parms, bssgp_bvc_ctx::fc, bssgp_dl_ud_par::fc, gsm48_generate_mid_from_imsi(), GSM48_MID_MAX_SIZE, bssgp_dl_ud_par::imsi, bssgp_lv::len, LOGL_ERROR, LOGP, mi, bssgp_dl_ud_par::ms_ra_cap, msg, msgb_bvci, msgb_free(), msgb_nsei, msgb_tlli, nsei, OSMO_ASSERT, osmo_htonl, osmo_htons, bssgp_ud_hdr::pdu_type, bssgp_dl_ud_par::qos_profile, bssgp_ud_hdr::qos_profile, rate_ctr_add(), rate_ctr_group_get_ctr(), bssgp_dl_ud_par::tlli, bssgp_ud_hdr::tlli, TVLV_MAX_ONEBYTE, and bssgp_lv::v.

## bssgp_tx_fc_bvc_ack()

static int bssgp_tx_fc_bvc_ack | ( | uint16_t | nsei,
|  | uint8_t | tag,
|  | uint16_t | ns_bvci
| ) |  |

static

References BSSGP_IE_TAG, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_FLOW_CONTROL_BVC_ACK, msg, msgb_bvci, msgb_nsei, nsei, and bssgp_normal_hdr::pdu_type.

Referenced by bssgp_rx_fc_bvc().

## bssgp_tx_paging()

int bssgp_tx_paging | ( | uint16_t | nsei,
|  | uint16_t | ns_bvci,
|  | struct bssgp_paging_info * | pinfo
| ) |  |

References BSSGP_IE_BSS_AREA_ID, BSSGP_IE_BVCI, BSSGP_IE_DRX_PARAMS, BSSGP_IE_IMSI, BSSGP_IE_LOCATION_AREA, BSSGP_IE_QOS_PROFILE, BSSGP_IE_TMSI, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PAGING_BSS_AREA, BSSGP_PAGING_BVCI, BSSGP_PAGING_LOCATION_AREA, BSSGP_PAGING_PS, BSSGP_PAGING_ROUTEING_AREA, BSSGP_PDUT_PAGING_CS, BSSGP_PDUT_PAGING_PS, bssgp_paging_info::bvci, bvci, bssgp_paging_info::drx_params, gsm48_encode_ra(), gsm48_generate_mid_from_imsi(), GSM48_MID_MAX_SIZE, bssgp_paging_info::imsi, mi, bssgp_paging_info::mode, msg, msgb_bvci, msgb_nsei, nsei, OSMO_ASSERT, osmo_htonl, osmo_htons, bssgp_normal_hdr::pdu_type, bssgp_paging_info::ptmsi, bssgp_paging_info::qos, bssgp_paging_info::raid, and bssgp_paging_info::scope.

## bssgp_tx_resume_ack()

int bssgp_tx_resume_ack | ( | uint16_t | nsei,
|  | uint32_t | tlli,
|  | const struct gprs_ra_id * | ra_id
| ) |  |

References bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_RESUME_ACK, msg, msgb_bvci, msgb_nsei, nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.

Referenced by bssgp_rx_resume().

## bssgp_tx_resume_nack()

int bssgp_tx_resume_nack | ( | uint16_t | nsei,
|  | uint32_t | tlli,
|  | const struct gprs_ra_id * | ra_id,
|  | uint8_t * | cause
| ) |  |

References BSSGP_IE_CAUSE, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_SUSPEND_NACK, cause, msg, msgb_bvci, msgb_nsei, nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.

Referenced by bssgp_rx_resume().

## bssgp_tx_suspend_ack()

int bssgp_tx_suspend_ack | ( | uint16_t | nsei,
|  | uint32_t | tlli,
|  | const struct gprs_ra_id * | ra_id,
|  | uint8_t | suspend_ref
| ) |  |

References BSSGP_IE_SUSPEND_REF_NR, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_SUSPEND_ACK, msg, msgb_bvci, msgb_nsei, nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.

Referenced by bssgp_rx_suspend().

## bssgp_tx_suspend_nack()

int bssgp_tx_suspend_nack | ( | uint16_t | nsei,
|  | uint32_t | tlli,
|  | const struct gprs_ra_id * | ra_id,
|  | uint8_t * | cause
| ) |  |

References BSSGP_IE_CAUSE, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_SUSPEND_NACK, cause, msg, msgb_bvci, msgb_nsei, nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.

Referenced by bssgp_rx_suspend().

## btsctx_alloc()

struct bssgp_bvc_ctx * btsctx_alloc | ( | uint16_t | bvci,
|  | uint16_t | nsei
| ) |  |

References _bssgp_tx_dl_ud(), bssgp_bvc_ctxts, bssgp_ctrg_desc, bssgp_fc_init(), bssgp_tall_ctx, bssgp_bvc_ctx::bvci, bvci, bssgp_bvc_ctx::ctrg, bssgp_bvc_ctx::fc, bssgp_bvc_ctx::is_sgsn, bssgp_bvc_ctx::list, bssgp_bvc_ctx::nsei, nsei, rate_ctr_group_alloc(), and rate_ctr_group_free().

Referenced by bssgp_rx_bvc_reset().

## btsctx_by_bvci_nsei()

struct bssgp_bvc_ctx * btsctx_by_bvci_nsei | ( | uint16_t | bvci,
|  | uint16_t | nsei
| ) |  |

References bssgp_bvc_ctxts, bssgp_bvc_ctx::bvci, bvci, bssgp_bvc_ctx::list, llist_for_each_entry, bssgp_bvc_ctx::nsei, and nsei.

Referenced by bssgp_fc_ms_init(), bssgp_rcvmsg(), bssgp_rx_bvc_block(), bssgp_rx_bvc_reset(), bssgp_rx_bvc_unblock(), bssgp_tx_dl_ud(), DEFUN(), and DEFUN().

## btsctx_by_raid_cid()

struct bssgp_bvc_ctx * btsctx_by_raid_cid | ( | const struct gprs_ra_id * | raid,
|  | uint16_t | cid
| ) |  |

References bssgp_bvc_ctxts, bssgp_bvc_ctx::cell_id, bssgp_bvc_ctx::list, llist_for_each_entry, and bssgp_bvc_ctx::ra_id.

## fc_enqueue()

static int fc_enqueue | ( | struct bssgp_flow_control * | fc,
|  | struct msgb * | msg,
|  | uint32_t | llc_pdu_len,
|  | void * | priv
| ) |  |

static

References fc_queue_timer_cfg(), bssgp_fc_queue_element::list, bssgp_fc_queue_element::llc_pdu_len, bssgp_flow_control::max_queue_depth, bssgp_fc_queue_element::msg, bssgp_fc_queue_element::priv, bssgp_flow_control::queue, and bssgp_flow_control::queue_depth.

Referenced by bssgp_fc_in().

## fc_queue_timer_cfg()

static int fc_queue_timer_cfg | ( | struct bssgp_flow_control * | fc | ) |

static

References bssgp_flow_control::bucket_leak_rate, fc_timer_cb(), bssgp_fc_queue_element::list, bssgp_fc_queue_element::llc_pdu_len, llist_entry, llist_head::next, osmo_timer_schedule(), osmo_timer_setup(), bssgp_flow_control::queue, and bssgp_flow_control::timer.

Referenced by bssgp_rx_fc_bvc(), fc_enqueue(), and fc_timer_cb().

## fc_timer_cb()

static void fc_timer_cb | ( | void * | data | ) |

static

References bssgp_fc_needs_queueing(), data, DLBSSGP, fc_queue_timer_cfg(), bssgp_fc_queue_element::list, bssgp_fc_queue_element::llc_pdu_len, llist_entry, LOGL_NOTICE, LOGP, bssgp_fc_queue_element::msg, llist_head::next, osmo_gettimeofday(), bssgp_flow_control::out_cb, bssgp_fc_queue_element::priv, bssgp_flow_control::queue, bssgp_flow_control::queue_depth, and bssgp_flow_control::time_last_pdu.

Referenced by fc_queue_timer_cfg().

## LLIST_HEAD()

LLIST_HEAD | ( | bssgp_bvc_ctxts |  | ) |

References LLIST_HEAD().

## tx_bvc_reset_nsei_bvci()

static int tx_bvc_reset_nsei_bvci | ( | enum bssgp_pdu_type | pdu,
|  | uint16_t | nsei,
|  | uint16_t | bvci,
|  | enum gprs_bssgp_cause | cause,
|  | const struct gprs_ra_id * | ra_id,
|  | uint16_t | cell_id
| ) |  |

static

References bssgp_cause_str(), bssgp_create_cell_id(), BSSGP_IE_BVCI, BSSGP_IE_CAUSE, BSSGP_IE_CELL_ID, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_BVC_RESET, BSSGP_PDUT_BVC_RESET_ACK, bvci, BVCI_SIGNALLING, cause, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, nsei, OSMO_ASSERT, osmo_htons, bssgp_normal_hdr::pdu_type, and ra_id.

Referenced by bssgp_tx_bvc_reset_ack_nsei_bvci(), and bssgp_tx_bvc_reset_nsei_bvci().

## Variable Documentation

## bssgp_ctr_description

const struct rate_ctr_desc bssgp_ctr_description[]

static

Initial value:
= {
{ "packets:in", "Packets at BSSGP Level ( In)" },
{ "packets:out","Packets at BSSGP Level (Out)" },
{ "bytes:in", "Bytes at BSSGP Level ( In)" },
{ "bytes:out", "Bytes at BSSGP Level (Out)" },
{ "blocked", "BVC Blocking count" },
{ "discarded", "BVC LLC Discarded count" },
{ "status", "BVC Status count" },
}

## bssgp_ctrg_desc

const struct rate_ctr_group_desc bssgp_ctrg_desc

static

Initial value:
= {
.group_name_prefix = "bssgp:bss_ctx",
.group_description = "BSSGP Peer Statistics",
.num_ctr = ARRAY_SIZE(bssgp_ctr_description),
.ctr_desc = bssgp_ctr_description,
.class_id = OSMO_STATS_CLASS_PEER,
}
bssgp_ctr_description
static const struct rate_ctr_desc bssgp_ctr_description[]
Definition gprs_bssgp.c:53
OSMO_STATS_CLASS_PEER
OSMO_STATS_CLASS_PEER
ARRAY_SIZE
#define ARRAY_SIZE(x)

Referenced by btsctx_alloc().

## bssgp_ns_send

bssgp_bvc_send bssgp_ns_send = _gprs_ns_sendmsg

Referenced by _bssgp_tx_dl_ud(), bssgp_set_bssgp_callback(), bssgp_tx_bvc_block(), bssgp_tx_bvc_unblock(), bssgp_tx_fc_bvc(), bssgp_tx_fc_bvc_ack(), bssgp_tx_fc_ms(), bssgp_tx_flush_ll_ack(), bssgp_tx_llc_discarded(), bssgp_tx_paging(), bssgp_tx_ra_capa_upd(), bssgp_tx_resume(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_rim(), bssgp_tx_rim_encoded(), bssgp_tx_simple_bvci(), bssgp_tx_status(), bssgp_tx_suspend(), bssgp_tx_suspend_ack(), bssgp_tx_suspend_nack(), bssgp_tx_ul_ud(), common_tx_radio_status2(), and tx_bvc_reset_nsei_bvci().

## bssgp_ns_send_data

void* bssgp_ns_send_data = NULL

Referenced by _bssgp_tx_dl_ud(), bssgp_set_bssgp_callback(), bssgp_tx_bvc_block(), bssgp_tx_bvc_unblock(), bssgp_tx_fc_bvc(), bssgp_tx_fc_bvc_ack(), bssgp_tx_fc_ms(), bssgp_tx_flush_ll_ack(), bssgp_tx_llc_discarded(), bssgp_tx_paging(), bssgp_tx_ra_capa_upd(), bssgp_tx_resume(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_rim(), bssgp_tx_rim_encoded(), bssgp_tx_simple_bvci(), bssgp_tx_status(), bssgp_tx_suspend(), bssgp_tx_suspend_ack(), bssgp_tx_suspend_nack(), bssgp_tx_ul_ud(), common_tx_radio_status2(), and tx_bvc_reset_nsei_bvci().

## bssgp_tall_ctx

void* bssgp_tall_ctx = NULL

Referenced by btsctx_alloc().