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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/22224 )
Change subject: paging: refactor and optimize fill_paging_type_1()
......................................................................
paging: refactor and optimize fill_paging_type_1()
As far as I can see from my perf measurements, bitvec_fill() is called
quite often and takes 0.27% of the CPU. A more detailed look reveals
that it's indirectly called by fill_paging_type_1() in order to fill
the remaining octets with constant '2B'O padding.
Let's optimize this function:
- use memset() for padding *before* writing optional P1 Rest Octets;
- conditionally initialize the bit vector for P1 Rest Octets;
- use designated initializers instead of memset().
Change-Id: I90473356b396e5dd9326598aca025afacca4afc8
---
M src/common/paging.c
1 file changed, 18 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/24/22224/1
diff --git a/src/common/paging.c b/src/common/paging.c
index fca58b5..2973141 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -352,34 +352,36 @@
uint8_t chan2, const struct p1_rest_octets *p1ro)
{
struct gsm48_paging1 *pt1 = (struct gsm48_paging1 *) out_buf;
- struct bitvec bv;
- unsigned int paging_len;
+ unsigned int ro_len;
uint8_t *cur;
- memset(out_buf, 0, sizeof(*pt1));
+ *pt1 = (struct gsm48_paging1) {
+ .proto_discr = GSM48_PDISC_RR,
+ .msg_type = GSM48_MT_RR_PAG_REQ_1,
+ .pag_mode = GSM48_PM_NORMAL,
+ .cneed1 = chan1 & 3,
+ .cneed2 = chan2 & 3,
+ };
- pt1->proto_discr = GSM48_PDISC_RR;
- pt1->msg_type = GSM48_MT_RR_PAG_REQ_1;
- pt1->pag_mode = GSM48_PM_NORMAL;
- pt1->cneed1 = chan1 & 3;
- pt1->cneed2 = chan2 & 3;
cur = lv_put(pt1->data, identity1_lv[0], identity1_lv+1);
if (identity2_lv)
cur = tlv_put(cur, GSM48_IE_MOBILE_ID, identity2_lv[0], identity2_lv+1);
pt1->l2_plen = L2_PLEN(cur - out_buf);
- paging_len = cur - out_buf;
+ /* Pad remaining octets with constant '2B'O */
+ ro_len = GSM_MACBLOCK_LEN - (cur - out_buf);
+ memset(cur, GSM_MACBLOCK_PADDING, ro_len);
- memset(&bv, 0, sizeof(bv));
- bv.data = cur;
- bv.data_len = GSM_MACBLOCK_LEN - paging_len;
+ /* Optional P1 Rest Octets */
+ if (p1ro) {
+ struct bitvec bv = {
+ .data_len = ro_len,
+ .data = cur,
+ };
- if (p1ro)
append_p1_rest_octets(&bv, p1ro);
-
- /* pad to the end of the MAC block */
- bitvec_spare_padding(&bv, bv.data_len *8);
+ }
return GSM_MACBLOCK_LEN;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/22224
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I90473356b396e5dd9326598aca025afacca4afc8
Gerrit-Change-Number: 22224
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210115/41ac35ef/attachment.htm>