[riot-notifications] [RIOT-OS/RIOT] RPL: API update suggestions (#11560)

Koen Zandberg notifications at github.com
Wed May 29 12:06:04 CEST 2019

bergzand commented on this pull request.

> @@ -259,8 +259,17 @@ struct gnrc_rpl_parent {
 typedef struct {
     uint16_t ocp;   /**< objective code point */
-    uint16_t (*calc_rank)(gnrc_rpl_parent_t *parent, uint16_t base_rank); /**< calculate the rank */
-    gnrc_rpl_parent_t *(*which_parent)(gnrc_rpl_parent_t *, gnrc_rpl_parent_t *); /**< retrieve the better parent */
+    /**
+     * @brief Calculate the rank of this node.
+     *
+     * @param[in]   dodag       RPL DODAG to calculate rank from.
+     * @param[in]   base_rank   BASE_RANK parameter as in rfc6550
+     *
+     * @return      RPL Rank of this node.
+     * @return      GNRC_RPL_INFINITE_RANK, if no rank calculation is possible.
+     */
+    uint16_t (*calc_rank)(gnrc_rpl_dodag_t *dodag, uint16_t base_rank);

I had to dig around a bit before I remembered why I suggested this change in the original PR.
I agree that the original function is more flexible for calculating the rank from any parent, however, the main use (and the only use) of this function is to calculate the rank of the current node in the dodag.

This change to `gnrc_rpl_dodag_t` was mainly to provide enough information to the function to also calculate the rank when using MRHOF as objective function. Rank calculation under MRHOF is a bit more complex as it needs the full set of parents from the preferred parent set for [rank calculation](https://tools.ietf.org/html/rfc6719#section-3.3) (this to prevent rank changes propagating through the dodag when selecting a new parent). With this in mind, it made more sense to me to pass the `gnrc_rpl_dodag_t` and retrieve the preferred parent with `dodag->parent` than to have retrieve the full dodag information from the current preferred parent.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190529/68bac0c1/attachment.html>

More information about the notifications mailing list