I've added support for configuration of default link tolerance:

# tipc-config -lt eth/12345
# tipc-config -be=eth:eth0/1.1.0
TIPC: Enabled bearer <eth:eth0>, discovery domain <1.1.0>, priority 10, default 
link tolerance 12345
tipc_link_create(): tolerance = 12345,cont intv = 500, abort_limit = 98
TIPC: Established link <1.1.4:eth0-1.1.5:eth0> on network plane A

However, whilst working on this, the locking scheme used
by tipc_link_cmd_config() got me very confused. Therefore i'm not
including a real patch -- instead i'll document what i did (and why)
and point at the things that i found odd.

net/tipc/tipc_bearer.h:
+ * @tolerance: default link tolerance for bearer
  * @nodes: indicates which nodes in cluster can be reached through bearer
  */
  
@@ -67,6 +68,7 @@ struct bearer {
        u32 continue_count;
        int active;
        char net_plane;
+       u16 tolerance;
        struct node_map nodes;
 };

Because TIPC currently only keeps track of link tolerance and media (default)
tolerance, we have to keep a per-bearer tolerance; otherwise you can only
change the default media link tolerance (and not on a per-bearer basis).

TIPC normally uses a "u32" tolerance; however the allowed values fit into u16,
and there is a 3 byte hole between net_plane and node_map that we can use.

If you think a four byte increase of struct bearer (which is rather large 
anyway)
is no problem then i can put it as u32 together with the bearer priority.

net/tipc/tipc_bearer.h:
+bool tipc_bearer_set_tolerance(const char *name, u32 tolerance);
+bool tipc_media_set_tolerance(const char *name, u32 tolerance);

Two new functions to set tolerance. Needed because tipc_bearer_find
does not look at disabled bearers. Since I added tipc_bearer_set_tolerance(),
i also decieded to add tipc_media_set_tolerance (as opposed to
exporting media_find_name() instead).

Now for the things that i did not understand...

tipc_link_cmd_config():

        read_lock_bh(&tipc_net_lock);
        l_ptr = link_find_link(args->name, &node); 
        if (!l_ptr) {
                read_unlock_bh(&tipc_net_lock);
                return tipc_cfg_reply_error_string("link not found");
        }
        node_lock(node);
[..]
        switch (cmd) {
        case TIPC_CMD_SET_LINK_TOL:
        etc, etc. 
[..]
        }
        node_unlock(node);

What is this node_lock() supposed to protect against?
AFAICS, node isn't touched at all, and
taking the tipc_net_lock should already protects against link deletion.
(The main reason for asking this is that I had put everything inside the
case TIPC_CMD_SET_LINK_TOL:
into a seperate function which resulted in _very_ ugly conditional locking that
I really want to avoid).

As soon as I've understood what the node_lock is doing there I'll post a 
complete
patch for review.

Regards,
Florian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to