29 Jan, 2008

40 commits

  • The info placeholder member of dst_entry seems to be unused in the
    network stack.

    Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     
  • Since __xfrm_policy_destroy is used to destory the resources
    allocated by xfrm_policy_alloc. So using the name
    __xfrm_policy_destroy is not correspond with xfrm_policy_alloc.
    Rename it to xfrm_policy_destroy.

    And along with some instances that call xfrm_policy_alloc
    but not using xfrm_policy_destroy to destroy the resource,
    fix them.

    Signed-off-by: WANG Cong
    Acked-by: Herbert Xu
    Signed-off-by: David S. Miller

    WANG Cong
     
  • o Increment PolError counter when flow_cache_lookup() returns
    errored pointer.

    o Increment NoStates counter at larval-drop.

    Signed-off-by: Masahide NAKAMURA
    Signed-off-by: David S. Miller

    Masahide NAKAMURA
     
  • It seems that ip_build_xmit is no longer used in here and
    ip_append_data is used.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Without a number of CONFIG.*DEBUG:

    net/dccp/ccids/ccid3.c:
    ccid3_hc_tx_update_x | -170
    ccid3_hc_tx_packet_sent | -175
    ccid3_hc_tx_packet_recv | -169
    ccid3_hc_tx_no_feedback_timer | -192
    ccid3_hc_tx_send_packet | -144
    5 functions changed, 850 bytes removed, diff: -850

    net/dccp/ccids/ccid3.c:
    ccid3_update_send_interval | +191
    1 function changed, 191 bytes added, diff: +191

    net/dccp/ccids/ccid3.o:
    6 functions changed, 191 bytes added, 850 bytes removed, diff: -659

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • net/xfrm/xfrm_state.c:
    xfrm_audit_state_delete | -589
    xfrm_replay_check | -542
    xfrm_audit_state_icvfail | -520
    xfrm_audit_state_add | -589
    xfrm_audit_state_replay_overflow | -523
    xfrm_audit_state_notfound_simple | -509
    xfrm_audit_state_notfound | -521
    7 functions changed, 3793 bytes removed, diff: -3793

    net/xfrm/xfrm_state.c:
    xfrm_audit_helper_pktinfo | +522
    xfrm_audit_helper_sainfo | +598
    2 functions changed, 1120 bytes added, diff: +1120

    net/xfrm/xfrm_state.o:
    9 functions changed, 1120 bytes added, 3793 bytes removed, diff: -2673

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • net/ipv4/ipvs/ip_vs_xmit.c:
    ip_vs_icmp_xmit | -638
    ip_vs_tunnel_xmit | -674
    ip_vs_nat_xmit | -716
    ip_vs_dr_xmit | -682
    4 functions changed, 2710 bytes removed, diff: -2710

    net/ipv4/ipvs/ip_vs_xmit.c:
    __ip_vs_get_out_rt | +595
    1 function changed, 595 bytes added, diff: +595

    net/ipv4/ipvs/ip_vs_xmit.o:
    5 functions changed, 595 bytes added, 2710 bytes removed, diff: -2115

    Without some CONFIG.*DEBUGs:

    net/ipv4/ipvs/ip_vs_xmit.o:
    5 functions changed, 383 bytes added, 1513 bytes removed, diff: -1130

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • /me awards the bloatiest-of-all-net/-.c-code award to
    nf_conntrack_netlink.c, congratulations to all the authors :-/!

    Hall of (unquestionable) fame (measured per inline, top 10 under
    net/):
    -4496 ctnetlink_parse_tuple netfilter/nf_conntrack_netlink.c
    -2165 ctnetlink_dump_tuples netfilter/nf_conntrack_netlink.c
    -2115 __ip_vs_get_out_rt ipv4/ipvs/ip_vs_xmit.c
    -1924 xfrm_audit_helper_pktinfo xfrm/xfrm_state.c
    -1799 ctnetlink_parse_tuple_proto netfilter/nf_conntrack_netlink.c
    -1268 ctnetlink_parse_tuple_ip netfilter/nf_conntrack_netlink.c
    -1093 ctnetlink_exp_dump_expect netfilter/nf_conntrack_netlink.c
    -1060 void ccid3_update_send_interval dccp/ccids/ccid3.c
    -983 ctnetlink_dump_tuples_proto netfilter/nf_conntrack_netlink.c
    -827 ctnetlink_exp_dump_tuple netfilter/nf_conntrack_netlink.c

    (i386 / gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-13) /
    allyesconfig except CONFIG_FORCED_INLINING)

    ...and I left < 200 byte gains as future work item.

    After iterative inline removal, I finally have this:

    net/netfilter/nf_conntrack_netlink.c:
    ctnetlink_exp_fill_info | -1104
    ctnetlink_new_expect | -1572
    ctnetlink_fill_info | -1303
    ctnetlink_new_conntrack | -2230
    ctnetlink_get_expect | -341
    ctnetlink_del_expect | -352
    ctnetlink_expect_event | -1110
    ctnetlink_conntrack_event | -1548
    ctnetlink_del_conntrack | -729
    ctnetlink_get_conntrack | -728
    10 functions changed, 11017 bytes removed, diff: -11017

    net/netfilter/nf_conntrack_netlink.c:
    ctnetlink_parse_tuple | +419
    dump_nat_seq_adj | +183
    ctnetlink_dump_counters | +166
    ctnetlink_dump_tuples | +261
    ctnetlink_exp_dump_expect | +633
    ctnetlink_change_status | +460
    6 functions changed, 2122 bytes added, diff: +2122

    net/netfilter/nf_conntrack_netlink.o:
    16 functions changed, 2122 bytes added, 11017 bytes removed, diff: -8895

    Without a number of CONFIG.*DEBUGs, I got this:
    net/netfilter/nf_conntrack_netlink.o:
    16 functions changed, 2122 bytes added, 11029 bytes removed, diff: -8907

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Previous NETNS patches broke CONFIG_SYSCTL=n case

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • - 'cb' is a fake struct member. In a previous patch struct cn_callback
    was renamed to cn_callback_id, so 'cb' should have been deleted at that
    time.

    - 'nls' isn't used and is redundant, we can retrieve this data through
    cn_callback_entry.pdev->nls.

    - 'seq' and 'group' should be u32, as they are declared to be u32 in
    other places.

    Signed-off-by: Li Zefan
    Signed-off-by: David S. Miller

    Li Zefan
     
  • Struct member netlink_groups is never used, and I don't see how it can
    be useful.

    Signed-off-by: Li Zefan
    Signed-off-by: David S. Miller

    Li Zefan
     
  • - __cn_rx_skb() does nothing but calls cn_call_callback(), it doesn't
    check skb and msg sizes as the comment suggests, but cn_rx_skb() checks
    those sizes.

    - In cn_rx_skb() Local variable 'len' is not used. 'len' is probably
    intended to be passed to skb_pull(), but here skb_pull() is not needed,
    instead skb_free() is called.

    Signed-off-by: Li Zefan
    Signed-off-by: David S. Miller

    Li Zefan
     
  • Each entry in the list has a unique id, so just break out of the
    loop if the matched id is found.

    Signed-off-by: Li Zefan
    Signed-off-by: David S. Miller

    Li Zefan
     
  • CHECK net/ipv4/icmp.c
    net/ipv4/icmp.c:249:13: warning: context imbalance in 'icmp_xmit_unlock' -
    unexpected unlock
    net/ipv4/icmp.c:376:13: warning: context imbalance in 'icmp_reply' - different
    lock contexts for basic block
    net/ipv4/icmp.c:430:6: warning: context imbalance in 'icmp_send' - different
    lock contexts for basic block

    Solution is to declare both icmp_xmit_lock() and icmp_xmit_unlock() as inline

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • 1) Cleanups (all functions are prefixed by sock_prot_inuse)

    sock_prot_inc_use(prot) -> sock_prot_inuse_add(prot,-1)
    sock_prot_dec_use(prot) -> sock_prot_inuse_add(prot,-1)
    sock_prot_inuse() -> sock_prot_inuse_get()

    New functions :

    sock_prot_inuse_init() and sock_prot_inuse_free() to abstract pcounter use.

    2) if CONFIG_PROC_FS=n, we can zap 'inuse' member from "struct proto",
    since nobody wants to read the inuse value.

    This saves 1372 bytes on i386/SMP and some cpu cycles.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • Before pushing pcounter to Linus tree, I would like to make some adjustments.

    Goal is to reduce kernel text size, by unlining too big functions.

    When a pcounter is bound to a statically defined per_cpu variable,
    we define two small helpers functions. (No more folding function
    using the fat for_each_possible_cpu(cpu) ... )

    static DEFINE_PER_CPU(int, NAME##_pcounter_values);
    static void NAME##_pcounter_add(struct pcounter *self, int val)
    {
    __get_cpu_var(NAME##_pcounter_values) += val;
    }
    static int NAME##_pcounter_getval(const struct pcounter *self, int cpu)
    {
    return per_cpu(NAME##_pcounter_values, cpu);
    }

    Fast path is therefore unchanged, while folding/alloc/free is now unlined.

    This saves 228 bytes on i386

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • We can void divides (as seen with CONFIG_CC_OPTIMIZE_FOR_SIZE=y on x86)
    changing ((HZ<<< idx)

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • In case of segments which are purely for control without any
    data (SYN/ACK/FIN/RST), many fields are set to common values
    in multiple places.

    i386 results:

    $ gcc --version
    gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-13)

    $ codiff tcp_output.o.old tcp_output.o.new
    net/ipv4/tcp_output.c:
    tcp_xmit_probe_skb | -48
    tcp_send_ack | -56
    tcp_retransmit_skb | -79
    tcp_connect | -43
    tcp_send_active_reset | -35
    tcp_make_synack | -42
    tcp_send_fin | -48
    7 functions changed, 351 bytes removed

    net/ipv4/tcp_output.c:
    tcp_init_nondata_skb | +90
    1 function changed, 90 bytes added

    tcp_output.o.mid:
    8 functions changed, 90 bytes added, 351 bytes removed, diff: -261

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Removed case indentation level & combined some nested ifs, mostly
    within 80 lines now. This is a leftover from indent patch, it
    just had to be done manually to avoid messing it up completely.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Previously we made it an error on the output path if the sequence number
    overflowed. However we did not set the err variable accordingly. This
    patch sets err to -EOVERFLOW in that case.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Add __acquires() and __releases() annotations to suppress some sparse
    warnings.

    example of warnings :

    net/ipv4/udp.c:1555:14: warning: context imbalance in 'udp_seq_start' - wrong
    count at exit
    net/ipv4/udp.c:1571:13: warning: context imbalance in 'udp_seq_stop' -
    unexpected unlock

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • …from include/net/ip_vs.h

    In include/net/ip_vs.h:
    - The ip_vs_secure_tcp_set() method is not implemented anywhere.
    - IP_VS_APP_TYPE_FTP is an unused definition.

    Signed-off-by: Rami Rosen <ramirose@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

    Rami Rosen
     
  • These three declarations in include/net/ip.h are not implemented
    anywhere:

    ip_mc_dropsocket(), ip_mc_dropdevice() and ip_net_unreachable().

    Also, correct a comment to be "Functions provided by ip_fragment.c"
    (instead of by ip_fragment.o) in consistency with the other comments
    in this header.

    Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     
  • This patch contains the scheduled removal of the shaper driver.

    Signed-off-by: Adrian Bunk
    Acked-by: Alan Cox
    Signed-off-by: David S. Miller

    Adrian Bunk
     
  • For five years we had two xfrm_policy_flush prototypes and every time that
    function's signature changed people have been diligently updating both of
    them without noticing :)

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Avoid an expensive divide (as done in commit
    18030477e70a826b91608aee40a987bbd368fec6 but lost in commit
    23821d2653111d20e75472c8c5003df1a55309a8)

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • These were manually selected from indent's results which as is
    are too noisy to be of any use without human reason. In addition,
    some extra newlines between function and its comment were removed
    too.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • The snd_up check should be enough. I suspect this has been
    there to provide a minor optimization in clean_rtx_queue which
    used to have a small if (!->sacked) block which could skip
    snd_up check among the other work.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • SACK reneging can be precalculated to a FLAG in clean_rtx_queue
    which has the right skb looked up. This will help a bit in
    future because skb->sacked access will be changed eventually,
    changing it already won't hurt any.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • There's very little need to have the packets_out incrementing in
    a separate function. Also name the combined function
    appropriately.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Earlier resolution for NewReno's sacked_out should now keep
    it small enough for this to become invariant-like check.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     
  • Signed-off-by: Takahiro Yasui
    Signed-off-by: Hideo Aoki
    Signed-off-by: David S. Miller

    Hideo Aoki
     
  • This patch introduces new memory accounting functions for each network
    protocol. Most of them are renamed from memory accounting functions
    for stream protocols. At the same time, some stream memory accounting
    functions are removed since other functions do same thing.

    Renaming:
    sk_stream_free_skb() -> sk_wmem_free_skb()
    __sk_stream_mem_reclaim() -> __sk_mem_reclaim()
    sk_stream_mem_reclaim() -> sk_mem_reclaim()
    sk_stream_mem_schedule -> __sk_mem_schedule()
    sk_stream_pages() -> sk_mem_pages()
    sk_stream_rmem_schedule() -> sk_rmem_schedule()
    sk_stream_wmem_schedule() -> sk_wmem_schedule()
    sk_charge_skb() -> sk_mem_charge()

    Removeing
    sk_stream_rfree(): consolidates into sock_rfree()
    sk_stream_set_owner_r(): consolidates into skb_set_owner_r()
    sk_stream_mem_schedule()

    The following functions are added.
    sk_has_account(): check if the protocol supports accounting
    sk_mem_uncharge(): do the opposite of sk_mem_charge()

    In addition, to achieve consolidation, updating sk_wmem_queued is
    removed from sk_mem_charge().

    Next, to consolidate memory accounting functions, this patch adds
    memory accounting calls to network core functions. Moreover, present
    memory accounting call is renamed to new accounting call.

    Finally we replace present memory accounting calls with new interface
    in TCP and SCTP.

    Signed-off-by: Takahiro Yasui
    Signed-off-by: Hideo Aoki
    Signed-off-by: David S. Miller

    Hideo Aoki
     
  • There are useless codes in fib6_del_route(). The following patch has
    been tested, every thing looks fine, as usual.

    Signed-off-by: Gui Jianfeng
    Signed-off-by: David S. Miller

    Gui Jianfeng