08 Dec, 2012

1 commit

  • Currently we have tipc_disconnect and tipc_disconnect_port. It is
    not clear from the names alone, what they do or how they differ.
    It turns out that tipc_disconnect just deals with the port locking
    and then calls tipc_disconnect_port which does all the work.

    If we rename as follows: tipc_disconnect_port --> __tipc_disconnect
    then we will be following typical linux convention, where:

    __tipc_disconnect: "raw" function that does all the work.

    tipc_disconnect: wrapper that deals with locking and then calls
    the real core __tipc_disconnect function

    With this, the difference is immediately evident, and locking
    violations are more apt to be spotted by chance while working on,
    or even just while reading the code.

    On the connect side of things, we currently only have the single
    "tipc_connect2port" function. It does both the locking at enter/exit,
    and the core of the work. Pending changes will make it desireable to
    have the connect be a two part locking wrapper + worker function,
    just like the disconnect is already.

    Here, we make the connect look just like the updated disconnect case,
    for the above reason, and for consistency. In the process, we also
    get rid of the "2port" suffix that was on the original name, since
    it adds no descriptive value.

    On close examination, one might notice that the above connect
    changes implicitly move the call to tipc_link_get_max_pkt() to be
    within the scope of tipc_port_lock() protected region; when it was
    not previously. We don't see any issues with this, and it is in
    keeping with __tipc_connect doing the work and tipc_connect just
    handling the locking.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

14 Jul, 2012

2 commits

  • The tipc_printf is renamed to tipc_snprintf, as the new name
    describes more what the function actually does. It is also
    changed to take a buffer and length parameter and return
    number of characters written to the buffer. All callers of
    this function that used to pass a print_buf are updated.

    Final removal of the struct print_buf itself will be done
    synchronously with the pending removal of the deprecated
    logging code that also was using it.

    Functions that build up a response message with a list of
    ports, nametable contents etc. are changed to return the number
    of characters written to the output buffer. This information
    was previously hidden in a field of the print_buf struct, and
    the number of chars written was fetched with a call to
    tipc_printbuf_validate. This function is removed since it
    is no longer referenced nor needed.

    A generic max size ULTRA_STRING_MAX_LEN is defined, named
    in keeping with the existing TIPC_TLV_ULTRA_STRING, and the
    various definitions in port, link and nametable code that
    largely duplicated this information are removed. This means
    that amount of link statistics that can be returned is now
    increased from 2k to 32k.

    The buffer overflow check is now done just before the reply
    message is passed over netlink or TIPC to a remote node and
    the message indicating a truncated buffer is changed to a less
    dramatic one (less CAPS), placed at the end of the message.

    Signed-off-by: Erik Hugne
    Signed-off-by: Jon Maloy
    Signed-off-by: Paul Gortmaker

    Erik Hugne
     
  • All messages should go directly to the kernel log. The TIPC
    specific error, warning, info and debug trace macro's are
    removed and all references replaced with pr_err, pr_warn,
    pr_info and pr_debug.

    Commonly used sub-strings are explicitly declared as a const
    char to reduce .text size.

    Note that this means the debug messages (changed to pr_debug),
    are now enabled through dynamic debugging, instead of a TIPC
    specific Kconfig option (TIPC_DEBUG). The latter will be
    phased out completely

    Signed-off-by: Erik Hugne
    Signed-off-by: Jon Maloy
    [PG: use pr_fmt as suggested by Joe Perches ]
    Signed-off-by: Paul Gortmaker

    Erik Hugne
     

11 Jul, 2012

1 commit


04 Jun, 2012

1 commit

  • Adding casts of objects to the same type is unnecessary
    and confusing for a human reader.

    For example, this cast:

    int y;
    int *p = (int *)&y;

    I used the coccinelle script below to find and remove these
    unnecessary casts. I manually removed the conversions this
    script produces of casts with __force and __user.

    @@
    type T;
    T *p;
    @@

    - (T *)p
    + p

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

01 May, 2012

1 commit

  • Some of the comment blocks are floating in limbo between two
    functions, or between blocks of code. Delete the extra line
    feeds between any comment and its associated following block
    of code, to be consistent with the majority of the rest of
    the kernel. Also delete trailing newlines at EOF and fix
    a couple trivial typos in existing comments.

    This is a 100% cosmetic change with no runtime impact. We get
    rid of over 500 lines of non-code, and being blank line deletes,
    they won't even show up as noise in git blame.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

27 Apr, 2012

1 commit

  • Consolidates validation of scope and name sequence range values into
    a single routine where it applies both to local name publications
    and to name publications issued by other nodes in the network. This
    change means that the scope value for non-local publications is now
    validated and the name sequence range for local publications is now
    validated only once. Additionally, a publication attempt that fails
    validation now creates an entry in the system log file only if debugging
    capabilities have been enabled; this prevents the system log from being
    cluttered up with messages caused by a defective application or network
    node.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

24 Apr, 2012

1 commit

  • Untie gcc's hands and let it do what it wants within the
    individual source files. There are two files, node.c and
    port.c -- only the latter effectively changes (gcc-4.5.2).
    Objdump shows gcc deciding to not inline port_peernode().

    Suggested-by: David S. Miller
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Paul Gortmaker
     

20 Apr, 2012

7 commits

  • Revises handling of a rejected message to ensure that a locally
    originated message is returned properly even if the node's network
    address is changed in mid-operation. The routine now treats the
    default node address of as an alias for "this node" when
    determining where to send a returned message.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Revises handling of send routines for payload messages to ensure that
    they are processed properly even if the node's network address is
    changed in mid-operation. The routines now treat the default node
    address of as an alias for "this node" when determining where
    to send an outgoing message.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • There are two send routines that might conceivably be asked by an
    application to send a message off-node when the node is still using
    the default network address. These now have an added check that
    detects this and rejects the message gracefully.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Revises routines that deal with connections between two ports on
    the same node to ensure the connection is not impacted if the node's
    network address is changed in mid-operation. The routines now treat
    the default node address of as an alias for "this node" in
    the following situations:

    1) Incoming messages destined to a connected port now handle the alias
    properly when validating that the message was sent by the expected
    peer port, ensuring that the message will be accepted regardless of
    whether it specifies the node's old network address or it's current one.

    2) The code which completes connection establishment now handles the
    alias properly when determining if the peer port is on the same node
    as the connected port.

    An added benefit of addressing issue 1) is that some peer port
    validation code has been relocated to TIPC's socket subsystem, which
    means that validation is no longer done twice when a message is
    sent to a non-socket port (such as TIPC's configuration service or
    network topology service).

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Prior to commit 23dd4cce387124ec3ea06ca30d17854ae4d9b772

    "tipc: Combine port structure with tipc_port structure"

    there was a need for the two sets of helper functions. But
    now they are just duplicates. Remove the globally visible
    ones, and mark the remaining ones as inline.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Re-orders port creation logic so that the initialization of a new
    port's message header template occurs while the port list lock is
    held. This ensures that a change to the node's network address that
    occurs at the same time as the port is being created does not result
    in the template identifying the sender using the former network
    address. The new approach guarantees that the new port's template is
    using the current network address or that it will be updated when
    the address changes.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Removes an unnecessary check in the logic that updates the message
    header template for existing ports when a node's network address is
    first assigned. There is no longer any need to check to see if the
    node's network address has actually changed since the calling routine
    has already verified that this is so.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

01 Mar, 2012

2 commits

  • Optimizes routines that send payload messages so that they no longer
    update the "originating node" and "originating port" fields of the
    outgoing message header template, since these fields are initialized
    when the sending port is created and never change thereafter. Also
    optimizes the routine which updates the message header template when
    a connection to a port is established, for the same reason.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Converts a non-trivial routine from inline to non-inline form
    to avoid bloating the TIPC code base with 6 copies of its body.

    This change is essentially cosmetic, and doesn't change existing
    TIPC behavior.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

25 Feb, 2012

2 commits

  • Restores name table translation using a non-zero domain that is
    "out of scope", which was broken by an earlier commit
    (5d9c54c1e9ececcf7e99c4f014f9bec7ee3a7def). Comments have now been
    added to the name table translation routine to make it clear that
    there are actually three possible outcomes to a translation request
    (found/not found/deferred), rather than just two (found/not found).

    Note that a straightforward revert of the earlier commit is not
    possible, as other changes to the name table translation logic
    have occurred since the incorrect optimization was made.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Gets rid of two inlined routines that simply call existing sk_buff
    manipulation routines, since there is no longer any extra processing
    done by the helper routines.

    Note that these changes are essentially cosmetic in nature, and have
    no impact on the actual operation of TIPC.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

07 Feb, 2012

1 commit


30 Dec, 2011

1 commit


25 Jun, 2011

9 commits

  • Simplifies the creation of connection protocol messages by eliminating
    the passing of information that is no longer required, is constant,
    or is contained within the port structure that is issuing the message.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Modifies the logic that creates a connection termination payload
    message so that it no longer (mis)uses a routine that creates a
    connection protocol message. The revised code is now more easily
    understood, and avoids setting several fields that are either not
    present in payload messages or were being set more than once.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Restructures the logic used in tipc_port_recv_proto_msg() to ensure
    that incoming connection protocol messages are handled properly. The
    routine now uses a two-stage process that first ensures the message
    applies on an existing connection and then processes the request.
    This corrects a loophole that allowed a connection probe request to
    be processed if it was sent to an unconnected port that had no names
    bound to it.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Speeds up the creation of the FIN message that terminates a TIPC
    connection. The typical peer termination message is now created by
    duplicating the terminating port's standard payload message header
    and adjusting the message size, importance, and error code fields,
    rather than building all fields of the message from scratch. A FIN
    message that is directed to the port itself is created the same way.
    but also requires swapping the origin and destination address fields.

    In addition to reducing the work required to create FIN messages,
    these changes eliminate several instances of duplicated code,

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Performs cosmetic cleanup of the symbolic names used to specify TIPC
    payload message header sizes. The revised names now more accurately
    reflect the payload messages in which they can appear. In addition,
    several places where these payload message symbol names were being used
    to create non-payload messages have been updated to use the proper
    internal message symbolic name.

    No functional changes are introduced by this rework.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Optimizes the creation of a returned payload message by duplicating
    the original message and then updating the small number of fields
    that need to be adjusted, rather than building the new message header
    from scratch. In addition, certain operations that are not always
    required are relocated so that they are only done if needed.

    These optimizations also have the effect of addressing other issues
    that were present previously:

    1) Fixes a bug that caused the socket send routines to return the
    size of the returned message, rather than the size of the sent
    message, when a returnable payload message was sent to a non-existent
    destination port.

    2) The message header of the returned message now matches that of
    the original message more closely. The header is now always the same
    size as the original header, and some message header fields that
    weren't being initialized in the returned message header are now
    populated correctly -- namely the "d" and "s" bits, and the upper
    bound of a multicast name instance (where present).

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Reduces the work involved in transmitting a returned payload message
    by doing only the work necessary to route such a message directly to
    the specified destination port, rather than invoking the code used
    to route an arbitrary message to an arbitrary destination.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Introduces an internal sanity check to ensure that the only undeliverable
    messages TIPC attempts to return to their origin are application payload
    messages.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Modifies the routine that handles the rejection of payload messages
    so that it has a single exit point that frees up the rejected message,
    thereby eliminating some duplicated code.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

11 May, 2011

4 commits

  • Rework TIPC's message sending routines to take advantage of the total
    amount of data value passed to it by the kernel socket infrastructure.
    This change eliminates the need for TIPC to compute the size of outgoing
    messages itself, as well as the check for an oversize message in
    tipc_msg_build(). In addition, this change warrants an explanation:

    - res = send_packet(NULL, sock, &my_msg, 0);
    + res = send_packet(NULL, sock, &my_msg, bytes_to_send);

    Previously, the final argument to send_packet() was ignored (since the
    amount of data being sent was recalculated by a lower-level routine)
    and we could just pass in a dummy value (0). Now that the
    recalculation is being eliminated, the argument value being passed to
    send_packet() is significant and we have to supply the actual amount
    of data we want to send.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Sets the destination node field of an incoming multicast message
    to the receiving node's network address before handing off the message
    to each receiving port. This ensures that, in the event the destination
    port returns the message to the sender, the sender can identify which
    node the destination port belonged to.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Set the destination node and destination port fields of an outgoing
    multicast message header to zero; this is necessary to ensure that
    the receiving node can route the message properly if it was packed
    into a bundle due to link congestion. (Previously, there was a chance
    that the receiving node would send the unbundled message to a random
    node & port, rather than processing the message itself.)

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Ensures that all outgoing data messages have the "name lookup scope"
    field of their header set correctly; that is, named multicast messages
    now specify cluster-wide name lookup, while messages not using TIPC
    naming zero out the lookup field. (Previously, the lookup scope specified
    for these types of messages was inherited from the last message sent
    by the sending port.)

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

24 Feb, 2011

3 commits

  • Eliminates TIPC's prototype support for message sequence numbering
    on routable connections (i.e. connections requiring more than one hop).
    This capability isn't currently used, and can be removed since TIPC
    only supports systems in which all inter-node communication can be
    achieved in a single hop.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Modifies TIPC's congestion control between a connected port and its
    peer so that it works as documented. The following changes have been
    made:

    1) The counter of the number of messages sent by a port now starts
    at zero, rather than one. This prevents the port from reporting port
    congestion one message earlier than it was supposed to.

    2) The counter of the number of messages sent by a port is now
    incremented only if a non-empty message is sent successfully.
    This prevents the port from becoming permanently congested if
    too many send attempts are unsuccessful because of congestion
    (or other reasons). It also removes the risk that empty hand-
    shaking messages used during connection setup might cause the
    port to report congestion earlier than it was supposed to.

    3) The counter of the number of unacknowledged messages received by
    a port controlled by an internal TIPC service is now incremented
    only if the message is non-empty, in order to be consistent with
    the aforementioned changes.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Merge two distinct structures containing information about a TIPC port
    into a single structure. The structures were previously kept separate
    so that public information about a port could be made available to
    applications using TIPC's native API, while the remaining information
    was kept private for use by TIPC itself. However, now that the native
    API has been removed there is no longer any need for this somewhat
    confusing arrangement.

    Since one of the structures was already embedded within the other, the
    change largely involves replacing instances of "publ.foo" with "foo".
    The changes do not otherwise alter the operation of TIPC ports.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

02 Jan, 2011

3 commits

  • Cleans up TIPC's source code to eliminate the presence of unnecessary
    use of {} around single statements.

    These changes are purely cosmetic and do not alter the operation of TIPC
    in any way.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens
     
  • Cleans up TIPC's source code to eliminate the needless initialization
    of static variables to zero.

    These changes are purely cosmetic and do not alter the operation of TIPC
    in any way.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens
     
  • Cleans up TIPC's source code to eliminate deviations from generally
    accepted coding conventions relating to leading/trailing white space
    and white space around commas, braces, cases, and sizeof.

    These changes are purely cosmetic and do not alter the operation of TIPC
    in any way.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens