1. 25 4月, 2013 1 次提交
    • P
      genl: Allow concurrent genl callbacks. · def31174
      Pravin B Shelar 提交于
      All genl callbacks are serialized by genl-mutex. This can become
      bottleneck in multi threaded case.
      Following patch adds an parameter to genl_family so that a
      particular family can get concurrent netlink callback without
      genl_lock held.
      New rw-sem is used to protect genl callback from genl family unregister.
      in case of parallel_ops genl-family read-lock is taken for callbacks and
      write lock is taken for register or unregistration for any family.
      In case of locked genl family semaphore and gel-mutex is locked for
      any openration.
      Signed-off-by: NPravin B Shelar <pshelar@nicira.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      def31174
  2. 11 9月, 2012 1 次提交
  3. 29 6月, 2012 1 次提交
    • T
      net: Use NLMSG_DEFAULT_SIZE in combination with nlmsg_new() · 58050fce
      Thomas Graf 提交于
      Using NLMSG_GOODSIZE results in multiple pages being used as
      nlmsg_new() will automatically add the size of the netlink
      header to the payload thus exceeding the page limit.
      
      NLMSG_DEFAULT_SIZE takes this into account.
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Cc: Jiri Pirko <jpirko@redhat.com>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Sergey Lapin <slapin@ossfans.org>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
      Cc: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Reviewed-by: NJiri Pirko <jpirko@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      58050fce
  4. 31 1月, 2012 1 次提交
  5. 04 12月, 2011 1 次提交
  6. 23 6月, 2011 1 次提交
    • J
      netlink: advertise incomplete dumps · 670dc283
      Johannes Berg 提交于
      Consider the following situation:
       * a dump that would show 8 entries, four in the first
         round, and four in the second
       * between the first and second rounds, 6 entries are
         removed
       * now the second round will not show any entry, and
         even if there is a sequence/generation counter the
         application will not know
      
      To solve this problem, add a new flag NLM_F_DUMP_INTR
      to the netlink header that indicates the dump wasn't
      consistent, this flag can also be set on the MSG_DONE
      message that terminates the dump, and as such above
      situation can be detected.
      
      To achieve this, add a sequence counter to the netlink
      callback struct. Of course, netlink code still needs
      to use this new functionality. The correct way to do
      that is to always set cb->seq when a dumpit callback
      is invoked and call nl_dump_check_consistent() for
      each new message. The core code will also call this
      function for the final MSG_DONE message.
      
      To make it usable with generic netlink, a new function
      genlmsg_nlhdr() is needed to obtain the netlink header
      from the genetlink user header.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      670dc283
  7. 10 5月, 2011 1 次提交
  8. 04 2月, 2011 1 次提交
  9. 06 10月, 2010 1 次提交
    • J
      genetlink: introduce pre_doit/post_doit hooks · ff4c92d8
      Johannes Berg 提交于
      Each family may have some amount of boilerplate
      locking code that applies to most, or even all,
      commands.
      
      This allows a family to handle such things in
      a more generic way, by allowing it to
       a) include private flags in each operation
       b) specify a pre_doit hook that is called,
          before an operation's doit() callback and
          may return an error directly,
       c) specify a post_doit hook that can undo
          locking or similar things done by pre_doit,
          and finally
       d) include two private pointers in each info
          struct passed between all these operations
          including doit(). (It's two because I'll
          need two in nl80211 -- can be extended.)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      ff4c92d8
  10. 02 6月, 2010 1 次提交
  11. 04 11月, 2009 1 次提交
  12. 13 7月, 2009 1 次提交
    • J
      genetlink: make netns aware · 134e6375
      Johannes Berg 提交于
      This makes generic netlink network namespace aware. No
      generic netlink families except for the controller family
      are made namespace aware, they need to be checked one by
      one and then set the family->netnsok member to true.
      
      A new function genlmsg_multicast_netns() is introduced to
      allow sending a multicast message in a given namespace,
      for example when it applies to an object that lives in
      that namespace, a new function genlmsg_multicast_allns()
      to send a message to all network namespaces (for objects
      that do not have an associated netns).
      
      The function genlmsg_multicast() is changed to multicast
      the message in just init_net, which is currently correct
      for all generic netlink families since they only work in
      init_net right now. Some will later want to work in all
      net namespaces because they do not care about the netns
      at all -- those will have to be converted to use one of
      the new functions genlmsg_multicast_allns() or
      genlmsg_multicast_netns() whenever they are made netns
      aware in some way.
      
      After this patch families can easily decide whether or
      not they should be available in all net namespaces. Many
      genl families us it for objects not related to networking
      and should therefore be available in all namespaces, but
      that will have to be done on a per family basis.
      
      Note that this doesn't touch on the checkpoint/restart
      problem where network namespaces could be used, genl
      families and multicast groups are numbered globally and
      I see no easy way of changing that, especially since it
      must be possible to multicast to all network namespaces
      for those families that do not care about netns.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      134e6375
  13. 22 5月, 2009 1 次提交
  14. 04 6月, 2008 1 次提交
  15. 19 7月, 2007 1 次提交
  16. 08 6月, 2007 1 次提交
  17. 03 12月, 2006 4 次提交
  18. 01 10月, 2006 1 次提交
  19. 23 9月, 2006 2 次提交
    • T
      [GENL]: Provide more information to userspace about registered genl families · eb328111
      Thomas Graf 提交于
      Additionaly exports the following information when providing
      the list of registered generic netlink families:
        - protocol version
        - header size
        - maximum number of attributes
        - list of available operations including
            - id
            - flags
            - avaiability of policy and doit/dumpit function
      
      libnl HEAD provides a utility to read this new information:
      
      	0x0010 nlctrl version 1
      	    hdrsize 0 maxattr 6
      	      op GETFAMILY (0x03) [POLICY,DOIT,DUMPIT]
      	0x0011 NLBL_MGMT version 1
      	    hdrsize 0 maxattr 0
      	      op unknown (0x02) [DOIT]
      	      op unknown (0x03) [DOIT]
      	      ....
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eb328111
    • T
      [NETLINK]: Add notification message sending interface · d387f6ad
      Thomas Graf 提交于
      Adds nlmsg_notify() implementing proper notification logic. The
      message is multicasted to all listeners in the group. The
      applications the requests orignates from can request a unicast
      back report in which case said socket will be excluded from the
      multicast to avoid duplicated notifications.
      
      nlmsg_multicast() is extended to take allocation flags to
      allow notification in atomic contexts.
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d387f6ad
  20. 15 7月, 2006 1 次提交
  21. 14 1月, 2006 1 次提交
  22. 04 1月, 2006 1 次提交
  23. 10 11月, 2005 1 次提交
    • T
      [NETLINK]: Generic netlink family · 482a8524
      Thomas Graf 提交于
      The generic netlink family builds on top of netlink and provides
      simplifies access for the less demanding netlink users. It solves
      the problem of protocol numbers running out by introducing a so
      called controller taking care of id management and name resolving.
      
      Generic netlink modules register themself after filling out their
      id card (struct genl_family), after successful registration the
      modules are able to register callbacks to command numbers by
      filling out a struct genl_ops and calling genl_register_op(). The
      registered callbacks are invoked with attributes parsed making
      life of simple modules a lot easier.
      
      Although generic netlink modules can request static identifiers,
      it is recommended to use GENL_ID_GENERATE and to let the controller
      assign a unique identifier to the module. Userspace applications
      will then ask the controller and lookup the idenfier by the module
      name.
      
      Due to the current multicast implementation of netlink, the number
      of generic netlink modules is restricted to 1024 to avoid wasting
      memory for the per socket multiacst subscription bitmask.
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      482a8524