diff options
author | Harald Welte <laforge@osmocom.org> | 2021-04-28 14:40:59 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-04-29 21:21:56 +0200 |
commit | 6bcc32bcfa50aa14e0dc517171d16b0cd7316a4b (patch) | |
tree | 66382b48e060c9ddd56d6eefbd315176aec8d699 | |
parent | 2672a2a2a706b03fbb0b1c5e49526368987c7658 (diff) |
ipa: Introduce support for user-specific DSCP and priority
This adds new members to struct ipa_server_link and ipa_client_conn,
which can be set by the user before ipa_client_conn_open() or
ipa_server_link_open() to ensure DSCP / priority values are applied
from the first outgoing packet onwards.
Change-Id: I5ab22d35d9b11eca47d9ea12208e5589a1a5713c
Depends: libosmocore.git If22988735fe05e51226c6b091a5348dcf1208cdf
-rw-r--r-- | TODO-RELEASE | 3 | ||||
-rw-r--r-- | include/osmocom/abis/ipa.h | 4 | ||||
-rw-r--r-- | src/input/ipa.c | 10 |
3 files changed, 15 insertions, 2 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE index d0852fc..8c417cd 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,6 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +update libosmocore dependency to > 1.5.1 for OSMO_SOCK_F_{DSCP,PRIO}() +libosmo-abis new member ipa_client_conn new struct members dscp, priority +libosmo-abis new member ipa_server_link new struct members dscp, priority diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 4764a95..7e13a6d 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -19,6 +19,8 @@ struct ipa_server_link { uint16_t port; int (*accept_cb)(struct ipa_server_link *link, int fd); void *data; + uint8_t dscp; + uint8_t priority; }; struct ipa_server_link * @@ -80,6 +82,8 @@ struct ipa_client_conn { struct msgb *pending_msg; const char *local_addr; uint16_t local_port; + uint8_t dscp; + uint8_t priority; }; struct ipa_client_conn * diff --git a/src/input/ipa.c b/src/input/ipa.c index f01ecd9..c121987 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -224,7 +224,8 @@ int ipa_client_conn_open(struct ipa_client_conn *link) ret = osmo_sock_init2(AF_INET, SOCK_STREAM, IPPROTO_TCP, link->local_addr, link->local_port, link->addr, link->port, - OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK); + OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK| + OSMO_SOCK_F_DSCP(link->dscp) | OSMO_SOCK_F_PRIO(link->priority)); if (ret < 0) return ret; link->ofd->fd = ret; @@ -282,6 +283,10 @@ static int ipa_server_fd_cb(struct osmo_fd *ofd, unsigned int what) LOGIPA(link, LOGL_NOTICE, "accept()ed new link from %s:%u\n", inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); + /* make new fd inherit DSCP + priority of listen-socket */ + osmo_sock_set_dscp(fd, link->dscp); + osmo_sock_set_priority(fd, link->priority); + ret = link->accept_cb(link, fd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, @@ -330,7 +335,8 @@ int ipa_server_link_open(struct ipa_server_link *link) int ret; ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP, - link->addr, link->port, OSMO_SOCK_F_BIND); + link->addr, link->port, OSMO_SOCK_F_BIND| + OSMO_SOCK_F_DSCP(link->dscp) | OSMO_SOCK_F_PRIO(link->priority)); if (ret < 0) return ret; |