laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30235 )
Change subject: cosmetic: rename upf_gtp_tun to upf_gtp_tunend ......................................................................
cosmetic: rename upf_gtp_tun to upf_gtp_tunend
Change-Id: I0815012679237838a031e28c0afb98b7e0d184bd --- M include/osmocom/upf/up_gtp_action.h M include/osmocom/upf/upf_gtp.h M src/osmo-upf/upf_gtp.c 3 files changed, 37 insertions(+), 37 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/include/osmocom/upf/up_gtp_action.h b/include/osmocom/upf/up_gtp_action.h index 5b4d5ee..8e291b7 100644 --- a/include/osmocom/upf/up_gtp_action.h +++ b/include/osmocom/upf/up_gtp_action.h @@ -54,7 +54,7 @@ enum up_gtp_action_kind kind; union { /* En-/De-capsulate GTP: add/remove a GTP header and forward the GTP payload from/to plain IP. */ - struct upf_gtp_tun_desc tunend; + struct upf_gtp_tunend_desc tunend;
/* Tunnel-map GTP: translate from one TEID to another and forward */ struct upf_nft_tunmap_desc tunmap; diff --git a/include/osmocom/upf/upf_gtp.h b/include/osmocom/upf/upf_gtp.h index 1e0df5e..ec0046d 100644 --- a/include/osmocom/upf/upf_gtp.h +++ b/include/osmocom/upf/upf_gtp.h @@ -60,14 +60,14 @@ struct llist_head tunnels; };
-struct upf_gtp_tun_desc { +struct upf_gtp_tunend_desc { uint32_t local_teid; uint32_t remote_teid; struct osmo_sockaddr ue_addr; struct osmo_sockaddr gtp_remote_addr; };
-int upf_gtp_tun_desc_cmp(const struct upf_gtp_tun_desc *a, const struct upf_gtp_tun_desc *b); +int upf_gtp_tunend_desc_cmp(const struct upf_gtp_tunend_desc *a, const struct upf_gtp_tunend_desc *b);
int upf_gtp_genl_ensure_open(); void upf_gtp_genl_close(); @@ -77,9 +77,9 @@ struct upf_gtp_dev *upf_gtp_dev_find_by_name(const char *name); struct upf_gtp_dev *upf_gtp_dev_first();
-int upf_gtp_dev_tunnel_add(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *t); -bool upf_gtp_dev_is_tunnel_active(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *t); -int upf_gtp_dev_tunnel_del(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *t); +int upf_gtp_dev_tunnel_add(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *t); +bool upf_gtp_dev_is_tunnel_active(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *t); +int upf_gtp_dev_tunnel_del(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *t);
int upf_gtp_dev_to_str_buf(char *buf, size_t buflen, const struct upf_gtp_dev *dev); char *upf_gtp_dev_to_str_c(void *ctx, const struct upf_gtp_dev *dev); diff --git a/src/osmo-upf/upf_gtp.c b/src/osmo-upf/upf_gtp.c index 880e587..6794a25 100644 --- a/src/osmo-upf/upf_gtp.c +++ b/src/osmo-upf/upf_gtp.c @@ -39,7 +39,7 @@ #include <osmocom/upf/upf_gtpu_echo.h>
#define LOG_GTP_TUN(TUN, LEVEL, FMT, ARGS...) \ - LOGP(DGTP, LEVEL, "%s: " FMT, upf_gtp_tun_to_str_c(OTC_SELECT, (TUN)), ##ARGS) + LOGP(DGTP, LEVEL, "%s: " FMT, upf_gtp_tunend_to_str_c(OTC_SELECT, (TUN)), ##ARGS)
int upf_gtp_dev_to_str_buf(char *buf, size_t buflen, const struct upf_gtp_dev *dev) { @@ -287,15 +287,15 @@ return 0; }
-struct upf_gtp_tun { +struct upf_gtp_tunend { struct llist_head entry;
struct upf_gtp_dev *dev; - struct upf_gtp_tun_desc desc; + struct upf_gtp_tunend_desc desc; bool active; };
-static int upf_gtp_tun_to_str_buf(char *buf, size_t buflen, const struct upf_gtp_tun *tun) +static int upf_gtp_tunend_to_str_buf(char *buf, size_t buflen, const struct upf_gtp_tunend *tun) { struct osmo_strbuf sb = { .buf = buf, .len = buflen }; OSMO_STRBUF_PRINTF(sb, "%s:tun{TEID=l:0x%x,r:0x%x UE=", tun->dev->name, tun->desc.local_teid, @@ -307,35 +307,35 @@ return sb.chars_needed; }
-static char *upf_gtp_tun_to_str_c(void *ctx, const struct upf_gtp_tun *tun) +static char *upf_gtp_tunend_to_str_c(void *ctx, const struct upf_gtp_tunend *tun) { - OSMO_NAME_C_IMPL(ctx, 64, "ERROR", upf_gtp_tun_to_str_buf, tun) + OSMO_NAME_C_IMPL(ctx, 64, "ERROR", upf_gtp_tunend_to_str_buf, tun) }
-static int upf_gtp_tun_deactivate(struct upf_gtp_tun *tun); +static int upf_gtp_tunend_deactivate(struct upf_gtp_tunend *tun);
-static int upf_gtp_tun_destruct(struct upf_gtp_tun *tun) +static int upf_gtp_tunend_destruct(struct upf_gtp_tunend *tun) { if (tun->active) - upf_gtp_tun_deactivate(tun); + upf_gtp_tunend_deactivate(tun); llist_del(&tun->entry); return 0; }
-static struct upf_gtp_tun *upf_gtp_tun_alloc(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *desc) +static struct upf_gtp_tunend *upf_gtp_tunend_alloc(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *desc) { - struct upf_gtp_tun *tun = talloc(dev, struct upf_gtp_tun); + struct upf_gtp_tunend *tun = talloc(dev, struct upf_gtp_tunend); OSMO_ASSERT(tun); - *tun = (struct upf_gtp_tun){ + *tun = (struct upf_gtp_tunend){ .dev = dev, .desc = *desc, }; llist_add(&tun->entry, &dev->tunnels); - talloc_set_destructor(tun, upf_gtp_tun_destruct); + talloc_set_destructor(tun, upf_gtp_tunend_destruct); return tun; }
-static struct gtp_tunnel *upf_gtp_tun_to_gtp_tunnel(struct upf_gtp_tun *tun) +static struct gtp_tunnel *upf_gtp_tunend_to_gtp_tunnel(struct upf_gtp_tunend *tun) { struct gtp_tunnel *t;
@@ -355,7 +355,7 @@ return t; }
-int upf_gtp_tun_activate(struct upf_gtp_tun *tun) +int upf_gtp_tunend_activate(struct upf_gtp_tunend *tun) { int rc; struct gtp_tunnel *t; @@ -363,7 +363,7 @@ if (tun->active) return -EALREADY;
- t = upf_gtp_tun_to_gtp_tunnel(tun); + t = upf_gtp_tunend_to_gtp_tunnel(tun); if (!t) return -ENOTSUP;
@@ -381,37 +381,37 @@ return rc; }
-static struct upf_gtp_tun *upf_gtp_dev_tunnel_find(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *tun_desc) +static struct upf_gtp_tunend *upf_gtp_dev_tunnel_find(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *tun_desc) { - struct upf_gtp_tun *tun; + struct upf_gtp_tunend *tun; llist_for_each_entry(tun, &dev->tunnels, entry) { - if (upf_gtp_tun_desc_cmp(tun_desc, &tun->desc)) + if (upf_gtp_tunend_desc_cmp(tun_desc, &tun->desc)) continue; return tun; } return NULL; }
-int upf_gtp_dev_tunnel_add(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *tun_desc) +int upf_gtp_dev_tunnel_add(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *tun_desc) { - struct upf_gtp_tun *tun; + struct upf_gtp_tunend *tun; tun = upf_gtp_dev_tunnel_find(dev, tun_desc); if (!tun) - tun = upf_gtp_tun_alloc(dev, tun_desc); + tun = upf_gtp_tunend_alloc(dev, tun_desc); if (tun->active) return 0; - return upf_gtp_tun_activate(tun); + return upf_gtp_tunend_activate(tun); }
-int upf_gtp_dev_tunnel_del(struct upf_gtp_dev *dev, const struct upf_gtp_tun_desc *tun_desc) +int upf_gtp_dev_tunnel_del(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *tun_desc) { - struct upf_gtp_tun *tun; + struct upf_gtp_tunend *tun; int rc; tun = upf_gtp_dev_tunnel_find(dev, tun_desc); if (!tun) return 0; if (tun->active) { - rc = upf_gtp_tun_deactivate(tun); + rc = upf_gtp_tunend_deactivate(tun); if (rc) return rc; } @@ -419,7 +419,7 @@ return 0; }
-static int upf_gtp_tun_deactivate(struct upf_gtp_tun *tun) +static int upf_gtp_tunend_deactivate(struct upf_gtp_tunend *tun) { int rc; struct gtp_tunnel *t; @@ -429,7 +429,7 @@ return -EINVAL; }
- t = upf_gtp_tun_to_gtp_tunnel(tun); + t = upf_gtp_tunend_to_gtp_tunnel(tun); if (!t) return -EINVAL;
@@ -445,9 +445,9 @@
static int upf_gtp_dev_destruct(struct upf_gtp_dev *dev) { - struct upf_gtp_tun *t; + struct upf_gtp_tunend *t; /* Destruct and clean up all active tunnels before deleting the device */ - while ((t = llist_first_entry_or_null(&dev->tunnels, struct upf_gtp_tun, entry))) + while ((t = llist_first_entry_or_null(&dev->tunnels, struct upf_gtp_tunend, entry))) talloc_free(t); llist_del(&dev->entry); /* osmo_fd_close() is a noop if ofd.fd == -1 */ @@ -458,7 +458,7 @@ return 0; }
-int upf_gtp_tun_desc_cmp(const struct upf_gtp_tun_desc *a, const struct upf_gtp_tun_desc *b) +int upf_gtp_tunend_desc_cmp(const struct upf_gtp_tunend_desc *a, const struct upf_gtp_tunend_desc *b) { int r;