Change in osmo-mgw[master]: refactor: use msgb to receive, pass and send RTP packets

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/.

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 23 14:57:22 UTC 2020


neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/18913 )

Change subject: refactor: use msgb to receive, pass and send RTP packets
......................................................................


Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/include/osmocom/mgcp/mgcp_endp.h 
File include/osmocom/mgcp/mgcp_endp.h:

https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/include/osmocom/mgcp/mgcp_endp.h@44 
PS1, Line 44: #define OSMO_RTP_MSG_CTX(MSGB) (*(struct osmo_rtp_msg_ctx**)&((MSGB)->dst))
> Ack
I was going to use a pointer to an externally stored struct,
and so using cb[0] didn't work, because assuming that unsigned long is guaranteed the size of a void* is bad, and gcc complains:

../../../../src/osmo-mgw/include/osmocom/mgcp/mgcp_endp.h:44:43: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
 #define OSMO_RTP_MSG_CTX(MSGB) (*((struct osmo_rtp_msg_ctx**)&((MSGB)->cb[0])))

But I see your approach uses the cb[] as storage itself.
Let's see, hopefully cb[] is large enough to store the entire struct.
Adding a static assert to ensure that, and it passes.

(Now of course no other msg->cb can be used anymore)

Making the struct part of the msgb is indeed nicer.
But on another note: are we really ever going to remove the dst pointer from msgb??


https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c 
File src/libosmo-mgcp/mgcp_network.c:

https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c@1302 
PS1, Line 1302: 	/* Since the msgb remains owned and freed by this function, the msg ctx data struct can just be on the stack and
> It may be the case now and I'm ok with it, but in the long term I'd argue it makes more sense to tra […]
agreed, for another patch maybe


https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c@1330 
PS1, Line 1330: static int rx_rtp(struct msgb *msg)
> Move this function on top of rtp_data_net and then you can drop the forward reference of rx_rtp at t […]
the reason to keep it here is to show the diff to the previous code



-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/18913
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I3af40b63bc49f8636d4e7ea2f8f83bb67f6619ee
Gerrit-Change-Number: 18913
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-CC: laforge <laforge at osmocom.org>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Tue, 23 Jun 2020 14:57:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin at sysmocom.de>
Comment-In-Reply-To: laforge <laforge at osmocom.org>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200623/477862a5/attachment.htm>


More information about the gerrit-log mailing list