This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26016 ) Change subject: hnb: Move wqueue to .iuh, add wrapper to use it ...................................................................... hnb: Move wqueue to .iuh, add wrapper to use it Change-Id: I38498858fc315ad3d57644d7b905f5393f43e884 --- M include/osmocom/hnodeb/hnodeb.h M src/osmo-hnodeb/hnb.c M src/osmo-hnodeb/hnbap.c M src/osmo-hnodeb/rua.c M src/osmo-hnodeb/vty.c 5 files changed, 27 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnodeb refs/changes/16/26016/1 diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h index 33375f6..d036bb2 100644 --- a/include/osmocom/hnodeb/hnodeb.h +++ b/include/osmocom/hnodeb/hnodeb.h @@ -75,9 +75,9 @@ 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; @@ -90,5 +90,7 @@ 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; diff --git a/src/osmo-hnodeb/hnb.c b/src/osmo-hnodeb/hnb.c index 85ca937..145c021 100644 --- a/src/osmo-hnodeb/hnb.c +++ b/src/osmo-hnodeb/hnb.c @@ -49,7 +49,7 @@ 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 @@ 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 @@ 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 @@ 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; +} diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c index 7e54004..7cd9cd6 100644 --- a/src/osmo-hnodeb/hnbap.c +++ b/src/osmo-hnodeb/hnbap.c @@ -145,7 +145,7 @@ 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 @@ 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 @@ msgb_sctp_ppid(msg) = IUH_PPI_HNBAP; - osmo_wqueue_enqueue(&hnb->wqueue, msg); + hnb_iuh_send(hnb, msg); } diff --git a/src/osmo-hnodeb/rua.c b/src/osmo-hnodeb/rua.c index 229df30..d7352b6 100644 --- a/src/osmo-hnodeb/rua.c +++ b/src/osmo-hnodeb/rua.c @@ -41,7 +41,7 @@ } rua = rua_new_dt(chan->is_ps, chan->conn_id, txm); - osmo_wqueue_enqueue(&hnb->wqueue, rua); + hnb_iuh_send(hnb, rua); return 0; } diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c index ab3b3fc..5dd849c 100644 --- a/src/osmo-hnodeb/vty.c +++ b/src/osmo-hnodeb/vty.c @@ -211,7 +211,7 @@ 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 @@ 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; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26016 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnodeb Gerrit-Branch: master Gerrit-Change-Id: I38498858fc315ad3d57644d7b905f5393f43e884 Gerrit-Change-Number: 26016 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211028/89304a6b/attachment.htm>