hnb: Move wqueue to .iuh, add wrapper to use it
Change-Id: I38498858fc315ad3d57644d7b905f5393f43e884
This commit is contained in:
parent
5c84fd43d9
commit
9b5e3d46d0
|
@ -58,9 +58,9 @@ struct hnb {
|
|||
uint16_t local_port;
|
||||
char *remote_addr;
|
||||
uint16_t remote_port;
|
||||
/*! SCTP socket + write queue for Iuh to this specific HNB */
|
||||
struct osmo_wqueue wqueue;
|
||||
} iuh;
|
||||
/*! SCTP socket + write queue for Iuh to this specific HNB */
|
||||
struct osmo_wqueue wqueue;
|
||||
|
||||
uint16_t rnc_id;
|
||||
|
||||
|
@ -73,5 +73,7 @@ struct hnb {
|
|||
struct hnb *hnb_alloc(void *tall_ctx);
|
||||
int hnb_connect(struct hnb *hnb);
|
||||
|
||||
int hnb_iuh_send(struct hnb *hnb, struct msgb *msg);
|
||||
|
||||
extern void *tall_hnb_ctx;
|
||||
extern struct hnb *g_hnb;
|
||||
|
|
|
@ -49,7 +49,7 @@ static int sctp_sock_init(int fd)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hnb_read_cb(struct osmo_fd *fd)
|
||||
static int hnb_iuh_read_cb(struct osmo_fd *fd)
|
||||
{
|
||||
struct hnb *hnb = fd->data;
|
||||
struct sctp_sndrcvinfo sinfo;
|
||||
|
@ -114,7 +114,7 @@ static int hnb_read_cb(struct osmo_fd *fd)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hnb_write_cb(struct osmo_fd *fd, struct msgb *msg)
|
||||
static int hnb_iuh_write_cb(struct osmo_fd *fd, struct msgb *msg)
|
||||
{
|
||||
/* struct hnb *ctx = fd->data; */
|
||||
struct sctp_sndrcvinfo sinfo = {
|
||||
|
@ -142,10 +142,10 @@ struct hnb *hnb_alloc(void *tall_ctx)
|
|||
hnb->iuh.remote_addr = talloc_strdup(hnb, "127.0.0.1");
|
||||
hnb->iuh.remote_port = IUH_DEFAULT_SCTP_PORT;
|
||||
|
||||
osmo_wqueue_init(&hnb->wqueue, 16);
|
||||
hnb->wqueue.bfd.data = hnb;
|
||||
hnb->wqueue.read_cb = hnb_read_cb;
|
||||
hnb->wqueue.write_cb = hnb_write_cb;
|
||||
osmo_wqueue_init(&hnb->iuh.wqueue, 16);
|
||||
hnb->iuh.wqueue.bfd.data = hnb;
|
||||
hnb->iuh.wqueue.read_cb = hnb_iuh_read_cb;
|
||||
hnb->iuh.wqueue.write_cb = hnb_iuh_write_cb;
|
||||
|
||||
return hnb;
|
||||
}
|
||||
|
@ -157,12 +157,21 @@ int hnb_connect(struct hnb *hnb)
|
|||
LOGP(DMAIN, LOGL_INFO, "Iuh Connect: %s[:%u] => %s[:%u]\n",
|
||||
hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port);
|
||||
|
||||
rc = osmo_sock_init2_ofd(&hnb->wqueue.bfd, AF_INET, SOCK_STREAM, IPPROTO_SCTP,
|
||||
rc = osmo_sock_init2_ofd(&hnb->iuh.wqueue.bfd, AF_INET, SOCK_STREAM, IPPROTO_SCTP,
|
||||
hnb->iuh.local_addr, hnb->iuh.local_port,
|
||||
hnb->iuh.remote_addr, hnb->iuh.remote_port,
|
||||
OSMO_SOCK_F_BIND |OSMO_SOCK_F_CONNECT);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
sctp_sock_init(hnb->wqueue.bfd.fd);
|
||||
sctp_sock_init(hnb->iuh.wqueue.bfd.fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hnb_iuh_send(struct hnb *hnb, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
rc = osmo_wqueue_enqueue(&hnb->iuh.wqueue, msg);
|
||||
if (rc < 0)
|
||||
msgb_free(msg);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ int hnb_ue_register_tx(struct hnb *hnb, const char *imsi_str)
|
|||
|
||||
msgb_sctp_ppid(msg) = IUH_PPI_HNBAP;
|
||||
|
||||
return osmo_wqueue_enqueue(&hnb->wqueue, msg);
|
||||
return hnb_iuh_send(hnb, msg);
|
||||
}
|
||||
|
||||
void hnb_send_register_req(struct hnb *hnb)
|
||||
|
@ -194,7 +194,7 @@ void hnb_send_register_req(struct hnb *hnb)
|
|||
|
||||
msgb_sctp_ppid(msg) = IUH_PPI_HNBAP;
|
||||
|
||||
osmo_wqueue_enqueue(&hnb->wqueue, msg);
|
||||
hnb_iuh_send(hnb, msg);
|
||||
}
|
||||
|
||||
void hnb_send_deregister_req(struct hnb *hnb)
|
||||
|
@ -222,5 +222,5 @@ void hnb_send_deregister_req(struct hnb *hnb)
|
|||
|
||||
msgb_sctp_ppid(msg) = IUH_PPI_HNBAP;
|
||||
|
||||
osmo_wqueue_enqueue(&hnb->wqueue, msg);
|
||||
hnb_iuh_send(hnb, msg);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ int hnb_tx_dt(struct hnb *hnb, struct msgb *txm)
|
|||
}
|
||||
|
||||
rua = rua_new_dt(chan->is_ps, chan->conn_id, txm);
|
||||
osmo_wqueue_enqueue(&hnb->wqueue, rua);
|
||||
hnb_iuh_send(hnb, rua);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ DEFUN(ranap_reset, ranap_reset_cmd,
|
|||
msg = ranap_new_msg_reset(is_ps, &cause);
|
||||
rua = rua_new_udt(msg);
|
||||
//msgb_free(msg);
|
||||
osmo_wqueue_enqueue(&g_hnb->wqueue, rua);
|
||||
hnb_iuh_send(g_hnb, rua);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ DEFUN(chan, chan_cmd,
|
|||
msg = gen_initue_lu(chan->is_ps, chan->conn_id, chan->imsi);
|
||||
rua = rua_new_conn(chan->is_ps, chan->conn_id, msg);
|
||||
|
||||
osmo_wqueue_enqueue(&g_hnb->wqueue, rua);
|
||||
hnb_iuh_send(g_hnb, rua);
|
||||
|
||||
vty->index = chan;
|
||||
vty->node = CHAN_NODE;
|
||||
|
|
Loading…
Reference in New Issue