1. 26 5月, 2009 1 次提交
    • E
      net: txq_trans_update() helper · 08baf561
      Eric Dumazet 提交于
      We would like to get rid of netdev->trans_start = jiffies; that about all net
      drivers have to use in their start_xmit() function, and use txq->trans_start
      instead.
      
      This can be done generically in core network, as suggested by David.
      
      Some devices, (particularly loopback) dont need trans_start update, because
      they dont have transmit watchdog. We could add a new device flag, or rely
      on fact that txq->tran_start can be updated is txq->xmit_lock_owner is
      different than -1. Use a helper function to hide our choice.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      08baf561
  2. 22 5月, 2009 1 次提交
  3. 31 3月, 2009 1 次提交
    • A
      proc 2/2: remove struct proc_dir_entry::owner · 99b76233
      Alexey Dobriyan 提交于
      Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
      as correctly noted at bug #12454. Someone can lookup entry with NULL
      ->owner, thus not pinning enything, and release it later resulting
      in module refcount underflow.
      
      We can keep ->owner and supply it at registration time like ->proc_fops
      and ->data.
      
      But this leaves ->owner as easy-manipulative field (just one C assignment)
      and somebody will forget to unpin previous/pin current module when
      switching ->owner. ->proc_fops is declared as "const" which should give
      some thoughts.
      
      ->read_proc/->write_proc were just fixed to not require ->owner for
      protection.
      
      rmmod'ed directories will be empty and return "." and ".." -- no harm.
      And directories with tricky enough readdir and lookup shouldn't be modular.
      We definitely don't want such modular code.
      
      Removing ->owner will also make PDE smaller.
      
      So, let's nuke it.
      
      Kudos to Jeff Layton for reminding about this, let's say, oversight.
      
      http://bugzilla.kernel.org/show_bug.cgi?id=12454Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      99b76233
  4. 27 2月, 2009 1 次提交
  5. 26 11月, 2008 1 次提交
  6. 21 11月, 2008 1 次提交
  7. 20 11月, 2008 1 次提交
  8. 11 11月, 2008 1 次提交
  9. 29 10月, 2008 1 次提交
  10. 28 10月, 2008 1 次提交
  11. 14 10月, 2008 1 次提交
  12. 14 8月, 2008 1 次提交
    • A
      pktgen: prevent pktgen from using bad tx queue · 64c00d81
      Andrew Gallatin 提交于
      With the new multi-queue transmit code, it is possible to accidentally
      make pktgen pick a non-existing tx queue simply by using a stale
      script to drive pktgen.  Access to this non-existing tx queue will
      then trigger a bad memory access and kill the machine.
      
      For example, setting "queue_map_max 2" will cause my machine to die
      when accessing a garbage spinlock in the non-existing tx queue:
      
      BUG: spinlock bad magic on CPU#0, kpktgend_0/564
        lock: ffff88001ddf6718, .magic: ffffffff, .owner: /-1, .owner_cpu: 0
      Pid: 564, comm: kpktgend_0 Not tainted 2.6.27-rc3 #35
      
      Call Trace:
        [<ffffffff803a1228>] spin_bug+0xa4/0xac
        [<ffffffff803a1253>] _raw_spin_lock+0x23/0x123
        [<ffffffff8055b06f>] _spin_lock_bh+0x17/0x1b
        [<ffffffff804cb57d>] pktgen_thread_worker+0xa97/0x1002
        [<ffffffff8022874d>] ? finish_task_switch+0x38/0x97
        [<ffffffff80242077>] ? autoremove_wake_function+0x0/0x36
        [<ffffffff80242077>] ? autoremove_wake_function+0x0/0x36
        [<ffffffff804caae6>] ? pktgen_thread_worker+0x0/0x1002
        [<ffffffff80241a40>] kthread+0x44/0x6d
        [<ffffffff8020c399>] child_rip+0xa/0x11
        [<ffffffff802419fc>] ? kthread+0x0/0x6d
        [<ffffffff8020c38f>] ? child_rip+0x0/0x11
      
      The attached patch adds some sanity checking to prevent
      these sorts of configuration errors.
      Signed-off-by: NAndrew Gallatin <gallatin@myri.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      64c00d81
  13. 07 8月, 2008 1 次提交
    • R
      pktgen: multiqueue etc. · e6fce5b9
      Robert Olsson 提交于
      Sofar far pktgen have had a restriction to only use one device per kernel 
      thread. With the new multiqueue architecture this is no longer adequate.
      
      The patch below is an effort to remove this by in pktgen configuration 
      adding a tag to  the device name a la eth0@0 etc. The tag is used for 
      usual device config just as before. Also a new flag is introduced to mirror 
      queue_map with sending threads smp_processor_id() QUEUE_MAP_CPU.
      
      An example: We use 4 CPU's to send to one 10g interface (eth0)
       and we use the new tagging to send a mix of packet sizes, 64, 576 and
       1500 bytes. Also we use TX queues according to smp_processor_id()
      
       PGDEV=/proc/net/pktgen/kpktgend_0
       pgset "add_device eth0@0" 
      
       PGDEV=/proc/net/pktgen/kpktgend_1
       pgset "add_device eth0@1" 
      
       PGDEV=/proc/net/pktgen/kpktgend_2
       pgset "add_device eth0@2" 
      
       PGDEV=/proc/net/pktgen/kpktgend_3
       pgset "add_device eth0@3" 
      ....
      PGDEV=/proc/net/pktgen/eth0@0 
      pgset "pkt_size 64"
      pgset "flag QUEUE_MAP_CPU"
      
      PGDEV=/proc/net/pktgen/eth0@1
      pgset "pkt_size 572"
      pgset "flag QUEUE_MAP_CPU"
      
      PGDEV=/proc/net/pktgen/eth0@2
      pgset "pkt_size 1496"
      
      PGDEV=/proc/net/pktgen/eth0@3
      pgset "pkt_size 1496"
      pgset "flag QUEUE_MAP_CPU"
      Signed-off-by: NRobert Olsson <robert.olsson@its.uu.se>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e6fce5b9
  14. 06 8月, 2008 2 次提交
  15. 01 8月, 2008 1 次提交
  16. 20 7月, 2008 1 次提交
  17. 18 7月, 2008 1 次提交
    • D
      net: Use queue aware tests throughout. · fd2ea0a7
      David S. Miller 提交于
      This effectively "flips the switch" by making the core networking
      and multiqueue-aware drivers use the new TX multiqueue structures.
      
      Non-multiqueue drivers need no changes.  The interfaces they use such
      as netif_stop_queue() degenerate into an operation on TX queue zero.
      So everything "just works" for them.
      
      Code that really wants to do "X" to all TX queues now invokes a
      routine that does so, such as netif_tx_wake_all_queues(),
      netif_tx_stop_all_queues(), etc.
      
      pktgen and netpoll required a little bit more surgery than the others.
      
      In particular the pktgen changes, whilst functional, could be largely
      improved.  The initial check in pktgen_xmit() will sometimes check the
      wrong queue, which is mostly harmless.  The thing to do is probably to
      invoke fill_packet() earlier.
      
      The bulk of the netpoll changes is to make the code operate solely on
      the TX queue indicated by by the SKB queue mapping.
      
      Setting of the SKB queue mapping is entirely confined inside of
      net/core/dev.c:dev_pick_tx().  If we end up needing any kind of
      special semantics (drops, for example) it will be implemented here.
      
      Finally, we now have a "real_num_tx_queues" which is where the driver
      indicates how many TX queues are actually active.
      
      With IGB changes from Jeff Kirsher.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd2ea0a7
  18. 21 5月, 2008 1 次提交
    • D
      pktgen: make sure that pktgen_thread_worker has been executed · d3ede327
      Denis V. Lunev 提交于
      The following courruption can happen during pktgen stop:
      list_del corruption. prev->next should be ffff81007e8a5e70, but was 6b6b6b6b6b6b6b6b
      kernel BUG at lib/list_debug.c:67!
            :pktgen:pktgen_thread_worker+0x374/0x10b0
            ? autoremove_wake_function+0x0/0x40
            ? _spin_unlock_irqrestore+0x42/0x80
            ? :pktgen:pktgen_thread_worker+0x0/0x10b0
            kthread+0x4d/0x80
            child_rip+0xa/0x12
            ? restore_args+0x0/0x30
            ? kthread+0x0/0x80
            ? child_rip+0x0/0x12
      RIP  list_del+0x48/0x70
      
      The problem is that pktgen_thread_worker can not be executed if kthread_stop
      has been called too early. Insert a completion on the normal initialization
      path to make sure that pktgen_thread_worker will gain the control for sure.
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Acked-by: NAlexey Dobriyan <adobriyan@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d3ede327
  19. 02 5月, 2008 1 次提交
  20. 26 3月, 2008 1 次提交
  21. 29 2月, 2008 1 次提交
  22. 01 2月, 2008 2 次提交
  23. 29 1月, 2008 4 次提交
  24. 20 11月, 2007 1 次提交
  25. 22 10月, 2007 2 次提交
  26. 20 10月, 2007 3 次提交
  27. 18 10月, 2007 1 次提交
    • H
      [IPSEC]: Rename mode to outer_mode and add inner_mode · 13996378
      Herbert Xu 提交于
      This patch adds a new field to xfrm states called inner_mode.  The existing
      mode object is renamed to outer_mode.
      
      This is the first part of an attempt to fix inter-family transforms.  As it
      is we always use the outer family when determining which mode to use.  As a
      result we may end up shoving IPv4 packets into netfilter6 and vice versa.
      
      What we really want is to use the inner family for the first part of outbound
      processing and the outer family for the second part.  For inbound processing
      we'd use the opposite pairing.
      
      I've also added a check to prevent silly combinations such as transport mode
      with inter-family transforms.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13996378
  28. 11 10月, 2007 5 次提交
    • S
      [NET]: sparse warning fixes · cfcabdcc
      Stephen Hemminger 提交于
      Fix a bunch of sparse warnings. Mostly about 0 used as
      NULL pointer, and shadowed variable declarations.
      One notable case was that hash size should have been unsigned.
      Signed-off-by: NStephen Hemminger <shemminger@linux-foundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cfcabdcc
    • J
      [NET]: Introduce and use print_mac() and DECLARE_MAC_BUF() · 0795af57
      Joe Perches 提交于
      This is nicer than the MAC_FMT stuff.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0795af57
    • E
      [NET]: Make the device list and device lookups per namespace. · 881d966b
      Eric W. Biederman 提交于
      This patch makes most of the generic device layer network
      namespace safe.  This patch makes dev_base_head a
      network namespace variable, and then it picks up
      a few associated variables.  The functions:
      dev_getbyhwaddr
      dev_getfirsthwbytype
      dev_get_by_flags
      dev_get_by_name
      __dev_get_by_name
      dev_get_by_index
      __dev_get_by_index
      dev_ioctl
      dev_ethtool
      dev_load
      wireless_process_ioctl
      
      were modified to take a network namespace argument, and
      deal with it.
      
      vlan_ioctl_set and brioctl_set were modified so their
      hooks will receive a network namespace argument.
      
      So basically anthing in the core of the network stack that was
      affected to by the change of dev_base was modified to handle
      multiple network namespaces.  The rest of the network stack was
      simply modified to explicitly use &init_net the initial network
      namespace.  This can be fixed when those components of the network
      stack are modified to handle multiple network namespaces.
      
      For now the ifindex generator is left global.
      
      Fundametally ifindex numbers are per namespace, or else
      we will have corner case problems with migration when
      we get that far.
      
      At the same time there are assumptions in the network stack
      that the ifindex of a network device won't change.  Making
      the ifindex number global seems a good compromise until
      the network stack can cope with ifindex changes when
      you change namespaces, and the like.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      881d966b
    • E
      [NET]: Make device event notification network namespace safe · e9dc8653
      Eric W. Biederman 提交于
      Every user of the network device notifiers is either a protocol
      stack or a pseudo device.  If a protocol stack that does not have
      support for multiple network namespaces receives an event for a
      device that is not in the initial network namespace it quite possibly
      can get confused and do the wrong thing.
      
      To avoid problems until all of the protocol stacks are converted
      this patch modifies all netdev event handlers to ignore events on
      devices that are not in the initial network namespace.
      
      As the rest of the code is made network namespace aware these
      checks can be removed.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e9dc8653
    • E
      [NET]: Make /proc/net per network namespace · 457c4cbc
      Eric W. Biederman 提交于
      This patch makes /proc/net per network namespace.  It modifies the global
      variables proc_net and proc_net_stat to be per network namespace.
      The proc_net file helpers are modified to take a network namespace argument,
      and all of their callers are fixed to pass &init_net for that argument.
      This ensures that all of the /proc/net files are only visible and
      usable in the initial network namespace until the code behind them
      has been updated to be handle multiple network namespaces.
      
      Making /proc/net per namespace is necessary as at least some files
      in /proc/net depend upon the set of network devices which is per
      network namespace, and even more files in /proc/net have contents
      that are relevant to a single network namespace.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      457c4cbc