gprs: Use new msgb->cb[] for storing a pointer to the NS-VC through which it was received

This commit is contained in:
Harald Welte 2010-04-30 16:43:39 +02:00
parent b7bd65ea01
commit 06aa111fda
2 changed files with 14 additions and 7 deletions

View File

@ -79,14 +79,17 @@ enum bts_gprs_mode {
BTS_GPRS_EGPRS = 2,
};
struct gprs_nsvc;
/* the data structure stored in msgb->cb for openbsc apps */
struct openbsc_msgb_cb {
unsigned char *gmmh;
struct gprs_nsvc *nsvc;
u_int32_t tlli;
};
#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
#define msgb_gmmh(__x) OBSC_MSGB_CB(__x)->gmmh
#define msgb_nsvc(__x) OBSC_MSGB_CB(__x)->nsvc
#define msgb_llch(__x) (__x)->l4h
struct msgb;

View File

@ -292,9 +292,10 @@ int gprs_ns_sendmsg(struct gprs_nsvc *nsvc, u_int16_t bvci,
}
/* Section 9.2.10: receive side */
static int gprs_ns_rx_unitdata(struct msgb *msg, struct gprs_nsvc *nsvc)
static int gprs_ns_rx_unitdata(struct msgb *msg)
{
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *)msg->l2h;
struct gprs_nsvc *nsvc = msgb_nsvc(msg);
u_int16_t bvci;
/* spare octet in data[0] */
@ -306,9 +307,10 @@ static int gprs_ns_rx_unitdata(struct msgb *msg, struct gprs_nsvc *nsvc)
}
/* Section 9.2.7 */
static int gprs_ns_rx_status(struct msgb *msg, struct gprs_nsvc *nsvc)
static int gprs_ns_rx_status(struct msgb *msg)
{
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
struct gprs_nsvc *nsvc = msgb_nsvc(msg);
struct tlv_parsed tp;
u_int8_t cause;
int rc;
@ -329,9 +331,10 @@ static int gprs_ns_rx_status(struct msgb *msg, struct gprs_nsvc *nsvc)
}
/* Section 7.3 */
static int gprs_ns_rx_reset(struct msgb *msg, struct gprs_nsvc *nsvc)
static int gprs_ns_rx_reset(struct msgb *msg)
{
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
struct gprs_nsvc *nsvc = msgb_nsvc(msg);
struct tlv_parsed tp;
u_int8_t *cause;
u_int16_t *nsvci, *nsei;
@ -385,9 +388,10 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
return -EIO;
nsvc = nsvc_create(nsi, 0xffff);
nsvc->ip.bts_addr = *saddr;
rc = gprs_ns_rx_reset(msg, nsvc);
rc = gprs_ns_rx_reset(msg);
return rc;
}
msgb_nsvc(msg) = nsvc;
switch (nsh->pdu_type) {
case NS_PDUT_ALIVE:
@ -404,13 +408,13 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
break;
case NS_PDUT_UNITDATA:
/* actual user data */
rc = gprs_ns_rx_unitdata(msg, nsvc);
rc = gprs_ns_rx_unitdata(msg);
break;
case NS_PDUT_STATUS:
rc = gprs_ns_rx_status(msg, nsvc);
rc = gprs_ns_rx_status(msg);
break;
case NS_PDUT_RESET:
rc = gprs_ns_rx_reset(msg, nsvc);
rc = gprs_ns_rx_reset(msg);
break;
case NS_PDUT_RESET_ACK:
DEBUGP(DGPRS, "NS RESET ACK\n");