]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCTP]: Remove sctp_add_cmd_sf wrapper bloat
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Fri, 28 Mar 2008 00:54:29 +0000 (17:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Mar 2008 00:54:29 +0000 (17:54 -0700)
With a was number of callsites sctp_add_cmd_sf wrapper bloats
kernel by some amount. Due to unlikely tracking allyesconfig,
with the initial result were around ~7kB (thus caught my
attention) while a non-debug config produced only ~2.3kB effect.

I (ij) proposed first a patch to uninline it but Vlad responded
with a patch that removed the only sctp_add_cmd call which is
wrapped by sctp_add_cmd_sf (I wasn't sure if I could do that).
I did minor cleanup to Vlad's patch.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/command.h
include/net/sctp/sm.h
net/sctp/command.c
net/sctp/sm_statefuns.c

index 10ae2da6f93bec65b2659b368b1b3a9081b5f9ca..4263af857794b8cb01f58840aee7f8ff520d6f36 100644 (file)
@@ -205,12 +205,11 @@ typedef struct {
 int sctp_init_cmd_seq(sctp_cmd_seq_t *seq);
 
 /* Add a command to an sctp_cmd_seq_t.
- * Return 0 if the command sequence is full.
  *
  * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
  * to wrap data which goes in the obj argument.
  */
-int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj);
+void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj);
 
 /* Return the next command structure in an sctp_cmd_seq.
  * Return NULL at the end of the sequence.
index ef9e7ed2c82e09aa49e3ca6c98c606ed0621e4ae..24811732bdb2515977d7defbb5b9ce548dcea315 100644 (file)
@@ -385,14 +385,6 @@ static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t)
        return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT));
 }
 
-
-/* Run sctp_add_cmd() generating a BUG() if there is a failure.  */
-static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)
-{
-       if (unlikely(!sctp_add_cmd(seq, verb, obj)))
-               BUG();
-}
-
 /* Check VTAG of the packet matches the sender's own tag. */
 static inline int
 sctp_vtag_verify(const struct sctp_chunk *chunk,
index bb977330002ac56307cda341fff68b2bc828baeb..c0044019db9eca2b84eaa9b11f28500bf0fb4086 100644 (file)
@@ -52,18 +52,12 @@ int sctp_init_cmd_seq(sctp_cmd_seq_t *seq)
 /* Add a command to a sctp_cmd_seq_t.
  * Return 0 if the command sequence is full.
  */
-int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)
+void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)
 {
-       if (seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS)
-               goto fail;
+       BUG_ON(seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS);
 
        seq->cmds[seq->next_free_slot].verb = verb;
        seq->cmds[seq->next_free_slot++].obj = obj;
-
-       return 1;
-
-fail:
-       return 0;
 }
 
 /* Return the next command structure in a sctp_cmd_seq.
index 6545b5fcbc73fda911136cade648f7db55bcad25..b534dbef864f91cad6456f1b04b6ed455a069280 100644 (file)
@@ -3135,12 +3135,8 @@ sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep,
                if (!ev)
                        goto nomem;
 
-               if (!sctp_add_cmd(commands, SCTP_CMD_EVENT_ULP,
-                                 SCTP_ULPEVENT(ev))) {
-                       sctp_ulpevent_free(ev);
-                       goto nomem;
-               }
-
+               sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP,
+                               SCTP_ULPEVENT(ev));
                sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR,
                                SCTP_CHUNK(chunk));
        }