1. 13 Nov, 2017 40 commits
    • David Howells's avatar
      afs: Make use of the YFS service upgrade to fully support IPv6 · bf99a53c
      David Howells authored
      YFS VL servers offer an upgraded Volume Location service that can return
      IPv6 addresses to fileservers and volume servers in addition to IPv4
      addresses using the YFSVL.GetEndpoints operation which we should use if
      it's available.
      
      To this end:
      
       (1) Make rxrpc_kernel_recv_data() return the call's current service ID so
           that the caller can detect service upgrade and see what the service
           was upgraded to.
      
       (2) When we see a VL server address we haven't seen before, send a
           VL.GetCapabilities operation to it with the service upgrade bit set.
      
           If we get an upgrade to the YFS VL service, change the service ID in
           the address list for that address to use the upgraded service and set
           a flag to note that this appears to be a YFS-compatible server.
      
       (3) If, when a server's addresses are being looked up, we note that we
           previously detected a YFS-compatible server, then send the
           YFSVL.GetEndpoints operation rather than VL.GetAddrsU.
      
       (4) Build a fileserver address list from the reply of YFSVL.GetEndpoints,
           including both IPv4 and IPv6 addresses.  Volume server addresses are
           discarded.
      
       (5) The address list is sorted by address and port now, instead of just
           address.  This allows multiple servers on the same host sitting on
           different ports.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      bf99a53c
    • David Howells's avatar
      afs: Overhaul volume and server record caching and fileserver rotation · d2ddc776
      David Howells authored
      The current code assumes that volumes and servers are per-cell and are
      never shared, but this is not enforced, and, indeed, public cells do exist
      that are aliases of each other.  Further, an organisation can, say, set up
      a public cell and a private cell with overlapping, but not identical, sets
      of servers.  The difference is purely in the database attached to the VL
      servers.
      
      The current code will malfunction if it sees a server in two cells as it
      assumes global address -> server record mappings and that each server is in
      just one cell.
      
      Further, each server may have multiple addresses - and may have addresses
      of different families (IPv4 and IPv6, say).
      
      To this end, the following structural changes are made:
      
       (1) Server record management is overhauled:
      
           (a) Server records are made independent of cell.  The namespace keeps
           	 track of them, volume records have lists of them and each vnode
           	 has a server on which its callback interest currently resides.
      
           (b) The cell record no longer keeps a list of servers known to be in
           	 that cell.
      
           (c) The server records are now kept in a flat list because there's no
           	 single address to sort on.
      
           (d) Server records are now keyed by their UUID within the namespace.
      
           (e) The addresses for a server are obtained with the VL.GetAddrsU
           	 rather than with VL.GetEntryByName, using the server's UUID as a
           	 parameter.
      
           (f) Cached server records are garbage collected after a period of
           	 non-use and are counted out of existence before purging is allowed
           	 to complete.  This protects the work functions against rmmod.
      
           (g) The servers list is now in /proc/fs/afs/servers.
      
       (2) Volume record management is overhauled:
      
           (a) An RCU-replaceable server list is introduced.  This tracks both
           	 servers and their coresponding callback interests.
      
           (b) The superblock is now keyed on cell record and numeric volume ID.
      
           (c) The volume record is now tied to the superblock which mounts it,
           	 and is activated when mounted and deactivated when unmounted.
           	 This makes it easier to handle the cache cookie without causing a
           	 double-use in fscache.
      
           (d) The volume record is loaded from the VLDB using VL.GetEntryByNameU
           	 to get the server UUID list.
      
           (e) The volume name is updated if it is seen to have changed when the
           	 volume is updated (the update is keyed on the volume ID).
      
       (3) The vlocation record is got rid of and VLDB records are no longer
           cached.  Sufficient information is stored in the volume record, though
           an update to a volume record is now no longer shared between related
           volumes (volumes come in bundles of three: R/W, R/O and backup).
      
      and the following procedural changes are made:
      
       (1) The fileserver cursor introduced previously is now fleshed out and
           used to iterate over fileservers and their addresses.
      
       (2) Volume status is checked during iteration, and the server list is
           replaced if a change is detected.
      
       (3) Server status is checked during iteration, and the address list is
           replaced if a change is detected.
      
       (4) The abort code is saved into the address list cursor and -ECONNABORTED
           returned in afs_make_call() if a remote abort happened rather than
           translating the abort into an error message.  This allows actions to
           be taken depending on the abort code more easily.
      
           (a) If a VMOVED abort is seen then this is handled by rechecking the
           	 volume and restarting the iteration.
      
           (b) If a VBUSY, VRESTARTING or VSALVAGING abort is seen then this is
               handled by sleeping for a short period and retrying and/or trying
               other servers that might serve that volume.  A message is also
               displayed once until the condition has cleared.
      
           (c) If a VOFFLINE abort is seen, then this is handled as VBUSY for the
           	 moment.
      
           (d) If a VNOVOL abort is seen, the volume is rechecked in the VLDB to
           	 see if it has been deleted; if not, the fileserver is probably
           	 indicating that the volume couldn't be attached and needs
           	 salvaging.
      
           (e) If statfs() sees one of these aborts, it does not sleep, but
           	 rather returns an error, so as not to block the umount program.
      
       (5) The fileserver iteration functions in vnode.c are now merged into
           their callers and more heavily macroised around the cursor.  vnode.c
           is removed.
      
       (6) Operations on a particular vnode are serialised on that vnode because
           the server will lock that vnode whilst it operates on it, so a second
           op sent will just have to wait.
      
       (7) Fileservers are probed with FS.GetCapabilities before being used.
           This is where service upgrade will be done.
      
       (8) A callback interest on a fileserver is set up before an FS operation
           is performed and passed through to afs_make_call() so that it can be
           set on the vnode if the operation returns a callback.  The callback
           interest is passed through to afs_iget() also so that it can be set
           there too.
      
      In general, record updating is done on an as-needed basis when we try to
      access servers, volumes or vnodes rather than offloading it to work items
      and special threads.
      
      Notes:
      
       (1) Pre AFS-3.4 servers are no longer supported, though this can be added
           back if necessary (AFS-3.4 was released in 1998).
      
       (2) VBUSY is retried forever for the moment at intervals of 1s.
      
       (3) /proc/fs/afs/<cell>/servers no longer exists.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      d2ddc776
    • David Howells's avatar
      afs: Move server rotation code into its own file · 9cc6fc50
      David Howells authored
      Move server rotation code into its own file.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      9cc6fc50
    • David Howells's avatar
      afs: Add an address list concept · 8b2a464c
      David Howells authored
      Add an RCU replaceable address list structure to hold a list of server
      addresses.  The list also holds the
      
      To this end:
      
       (1) A cell's VL server address list can be loaded directly via insmod or
           echo to /proc/fs/afs/cells or dynamically from a DNS query for AFSDB
           or SRV records.
      
       (2) Anyone wanting to use a cell's VL server address must wait until the
           cell record comes online and has tried to obtain some addresses.
      
       (3) An FS server's address list, for the moment, has a single entry that
           is the key to the server list.  This will change in the future when a
           server is instead keyed on its UUID and the VL.GetAddrsU operation is
           used.
      
       (4) An 'address cursor' concept is introduced to handle iteration through
           the address list.  This is passed to the afs_make_call() as, in the
           future, stuff (such as abort code) that doesn't outlast the call will
           be returned in it.
      
      In the future, we might want to annotate the list with information about
      how each address fares.  We might then want to propagate such annotations
      over address list replacement.
      
      Whilst we're at it, we allow IPv6 addresses to be specified in
      colon-delimited lists by enclosing them in square brackets.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      8b2a464c
    • David Howells's avatar
      afs: Overhaul cell database management · 989782dc
      David Howells authored
      Overhaul the way that the in-kernel AFS client keeps track of cells in the
      following manner:
      
       (1) Cells are now held in an rbtree to make walking them quicker and RCU
           managed (though this is probably overkill).
      
       (2) Cells now have a manager work item that:
      
           (A) Looks after fetching and refreshing the VL server list.
      
           (B) Manages cell record lifetime, including initialising and
           	 destruction.
      
           (B) Manages cell record caching whereby threads are kept around for a
           	 certain time after last use and then destroyed.
      
           (C) Manages the FS-Cache index cookie for a cell.  It is not permitted
           	 for a cookie to be in use twice, so we have to be careful to not
           	 allow a new cell record to exist at the same time as an old record
           	 of the same name.
      
       (3) Each AFS network namespace is given a manager work item that manages
           the cells within it, maintaining a single timer to prod cells into
           updating their DNS records.
      
           This uses the reduce_timer() facility to make the timer expire at the
           soonest timed event that needs happening.
      
       (4) When a module is being unloaded, cells and cell managers are now
           counted out using dec_after_work() to make sure the module text is
           pinned until after the data structures have been cleaned up.
      
       (5) Each cell's VL server list is now protected by a seqlock rather than a
           semaphore.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      989782dc
    • David Howells's avatar
      afs: Overhaul permit caching · be080a6f
      David Howells authored
      Overhaul permit caching in AFS by making it per-vnode and sharing permit
      lists where possible.
      
      When most of the fileserver operations are called, they return a status
      structure indicating the (revised) details of the vnode or vnodes involved
      in the operation.  This includes the access mark derived from the ACL
      (named CallerAccess in the protocol definition file).  This is cacheable
      and if the ACL changes, the server will tell us that it is breaking the
      callback promise, at which point we can discard the currently cached
      permits.
      
      With this patch, the afs_permits structure has, at the end, an array of
      { key, CallerAccess } elements, sorted by key pointer.  This is then cached
      in a hash table so that it can be shared between vnodes with the same
      access permits.
      
      Permit lists can only be shared if they contain the exact same set of
      key->CallerAccess mappings.
      
      Note that that table is global rather than being per-net_ns.  If the keys
      in a permit list cross net_ns boundaries, there is no problem sharing the
      cached permits, since the permits are just integer masks.
      
      Since permit lists pin keys, the permit cache also makes it easier for a
      future patch to find all occurrences of a key and remove them by means of
      setting the afs_permits::invalidated flag and then clearing the appropriate
      key pointer.  In such an event, memory barriers will need adding.
      
      Lastly, the permit caching is skipped if the server has sent either a
      vnode-specific or an entire-server callback since the start of the
      operation.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      be080a6f
    • David Howells's avatar
      afs: Overhaul the callback handling · c435ee34
      David Howells authored
      Overhaul the AFS callback handling by the following means:
      
       (1) Don't give up callback promises on vnodes that we are no longer using,
           rather let them just expire on the server or let the server break
           them.  This is actually more efficient for the server as the callback
           lookup is expensive if there are lots of extant callbacks.
      
       (2) Only give up the callback promises we have from a server when the
           server record is destroyed.  Then we can just give up *all* the
           callback promises on it in one go.
      
       (3) Servers can end up being shared between cells if cells are aliased, so
           don't add all the vnodes being backed by a particular server into a
           big FID-indexed tree on that server as there may be duplicates.
      
           Instead have each volume instance (~= superblock) register an interest
           in a server as it starts to make use of it and use this to allow the
           processor for callbacks from the server to find the superblock and
           thence the inode corresponding to the FID being broken by means of
           ilookup_nowait().
      
       (4) Rather than iterating over the entire callback list when a mass-break
           comes in from the server, maintain a counter of mass-breaks in
           afs_server (cb_seq) and make afs_validate() check it against the copy
           in afs_vnode.
      
           It would be nice not to have to take a read_lock whilst doing this,
           but that's tricky without using RCU.
      
       (5) Save a ref on the fileserver we're using for a call in the afs_call
           struct so that we can access its cb_s_break during call decoding.
      
       (6) Write-lock around callback and status storage in a vnode and read-lock
           around getattr so that we don't see the status mid-update.
      
      This has the following consequences:
      
       (1) Data invalidation isn't seen until someone calls afs_validate() on a
           vnode.  Unfortunately, we need to use a key to query the server, but
           getting one from a background thread is tricky without caching loads
           of keys all over the place.
      
       (2) Mass invalidation isn't seen until someone calls afs_validate().
      
       (3) Callback breaking is going to hit the inode_hash_lock quite a bit.
           Could this be replaced with rcu_read_lock() since inodes are destroyed
           under RCU conditions.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      c435ee34
    • David Howells's avatar
      afs: Rename struct afs_call server member to cm_server · d0676a16
      David Howells authored
      Rename the server member of struct afs_call to cm_server as we're only
      going to be using it for incoming calls for the Cache Manager service.
      This makes it easier to differentiate from the pointer to the target server
      for the client, which will point to a different structure to allow for
      callback handling.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      d0676a16
    • David Howells's avatar
      afs: Fix the afs_uuid struct to make the char-sized fields signed · 03dc2cfc
      David Howells authored
      In AFS's encoding of a UUID, the eight 'char' fields are all signed, so
      represent them with __s8 rather than __u8.  This makes the compiler
      sign-extend them correctly when XDR-encoding them.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      03dc2cfc
    • David Howells's avatar
      afs: Connect up the CB.ProbeUuid · f4b3526d
      David Howells authored
      The handler for the CB.ProbeUuid operation in the cache manager is
      implemented, but isn't listed in the switch-statement of operation
      selection, so won't be used.  Fix this by adding it.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      f4b3526d
    • David Howells's avatar
      afs: Potentially return call->reply[0] from afs_make_call() · 33cd7f2b
      David Howells authored
      If call->ret_reply0 is set, return call->reply[0] on success.  Change the
      return type of afs_make_call() to long so that this can be passed back
      without bit loss and then cast to a pointer if required.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      33cd7f2b
    • David Howells's avatar
      afs: Condense afs_call's reply{,2,3,4} into an array · 97e3043a
      David Howells authored
      Condense struct afs_call's reply anchor members - reply{,2,3,4} - into an
      array.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      97e3043a
    • David Howells's avatar
      afs: Consolidate abort_to_error translators · f780c8ea
      David Howells authored
      The AFS abort code space is shared across all services, so there's no need
      for separate abort_to_error translators for each service.
      
      Consolidate them into a single function and remove the function pointers
      for them.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      f780c8ea
    • David Howells's avatar
      afs: Allow IPv6 address specification of VL servers · 3838d3ec
      David Howells authored
      Allow VL server specifications to be given IPv6 addresses as well as IPv4
      addresses, for example as:
      
      	echo add foo.org 1111:2222:3333:0:4444:5555:6666:7777 >/proc/fs/afs/cells
      
      Note that ':' is the expected separator for separating IPv4 addresses, but
      if a ',' is detected or no '.' is detected in the string, the delimiter is
      switched to ','.
      
      This also works with DNS AFSDB or SRV record strings fetched by upcall from
      userspace.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      3838d3ec
    • David Howells's avatar
      afs: Keep and pass sockaddr_rxrpc addresses rather than in_addr · 4d9df986
      David Howells authored
      Keep and pass sockaddr_rxrpc addresses around rather than keeping and
      passing in_addr addresses to allow for the use of IPv6 and non-standard
      port numbers in future.
      
      This also allows the port and service_id fields to be removed from the
      afs_call struct.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      4d9df986
    • David Howells's avatar
      afs: Update the cache index structure · ad6a942a
      David Howells authored
      Update the cache index structure in the following ways:
      
       (1) Don't use the volume name followed by the volume type as levels in the
           cache index.  Volumes can be renamed.  Use the volume ID instead.
      
       (2) Don't store the VLDB data for a volume in the tree.  If the volume
           database should be cached locally, then it should be done in a separate
           tree.
      
       (3) Expand the volume ID stored in the cache to 64 bits.
      
       (4) Expand the file/vnode ID stored in the cache to 96 bits.
      
       (5) Increment the cache structure version number to 1.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      ad6a942a
    • David Howells's avatar
      afs: Add some protocol defs · 91a90380
      David Howells authored
      Add some protocol definitions, including max field lengths, flag defs, an
      XDR-encoded UUID def, more VL operation IDs and more fileserver abort
      codes.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      91a90380
    • David Howells's avatar
      afs: Push the net ns pointer to more places · 9ed900b1
      David Howells authored
      Push the network namespace pointer to more places in AFS, including the
      afs_server structure (which doesn't hold a ref on the netns).
      
      In particular, afs_put_cell() now takes requires a net ns parameter so that
      it can safely alter the netns after decrementing the cell usage count - the
      cell will be deallocated by a background thread after being cached for a
      period, which means that it's not safe to access it after reducing its
      usage count.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      9ed900b1
    • David Howells's avatar
      afs: Note the cell in the superblock info also · 49566f6f
      David Howells authored
      Keep a reference to the cell in the superblock info structure in addition
      to the volume and net pointers.  This will make it easier to clean up in a
      future patch in which afs_put_volume() will need the cell pointer.
      
      Whilst we're at it, make the cell and volume getting functions return a
      pointer to the object got to make the call sites look neater.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      49566f6f
    • David Howells's avatar
      afs: Fix server reaping · 59fa1c4a
      David Howells authored
      Fix server reaping and make sure it's all done before we start trying to
      purge cells, given that servers currently pin cells.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      59fa1c4a
    • David Howells's avatar
      afs: Close the rxrpc socket only after purging the servers · e3b2ffe0
      David Howells authored
      Close the rxrpc socket only after we've purged the server records (and also
      cell and volume records which might refer to servers) so that we can give
      up the callbacks on each server.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      e3b2ffe0
    • David Howells's avatar
      afs: Lay the groundwork for supporting network namespaces · f044c884
      David Howells authored
      Lay the groundwork for supporting network namespaces (netns) to the AFS
      filesystem by moving various global features to a network-namespace struct
      (afs_net) and providing an instance of this as a temporary global variable
      that everything uses via accessor functions for the moment.
      
      The following changes have been made:
      
       (1) Store the netns in the superblock info.  This will be obtained from
           the mounter's nsproxy on a manual mount and inherited from the parent
           superblock on an automount.
      
       (2) The cell list is made per-netns.  It can be viewed through
           /proc/net/afs/cells and also be modified by writing commands to that
           file.
      
       (3) The local workstation cell is set per-ns in /proc/net/afs/rootcell.
           This is unset by default.
      
       (4) The 'rootcell' module parameter, which sets a cell and VL server list
           modifies the init net namespace, thereby allowing an AFS root fs to be
           theoretically used.
      
       (5) The volume location lists and the file lock manager are made
           per-netns.
      
       (6) The AF_RXRPC socket and associated I/O bits are made per-ns.
      
      The various workqueues remain global for the moment.
      
      Changes still to be made:
      
       (1) /proc/fs/afs/ should be moved to /proc/net/afs/ and a symlink emplaced
           from the old name.
      
       (2) A per-netns subsys needs to be registered for AFS into which it can
           store its per-netns data.
      
       (3) Rather than the AF_RXRPC socket being opened on module init, it needs
           to be opened on the creation of a superblock in that netns.
      
       (4) The socket needs to be closed when the last superblock using it is
           destroyed and all outstanding client calls on it have been completed.
           This prevents a reference loop on the namespace.
      
       (5) It is possible that several namespaces will want to use AFS, in which
           case each one will need its own UDP port.  These can either be set
           through /proc/net/afs/cm_port or the kernel can pick one at random.
           The init_ns gets 7001 by default.
      
      Other issues that need resolving:
      
       (1) The DNS keyring needs net-namespacing.
      
       (2) Where do upcalls go (eg. DNS request-key upcall)?
      
       (3) Need something like open_socket_in_file_ns() syscall so that AFS
           command line tools attempting to operate on an AFS file/volume have
           their RPC calls go to the right place.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      f044c884
    • David Howells's avatar
      Pass mode to wait_on_atomic_t() action funcs and provide default actions · 5e4def20
      David Howells authored
      Make wait_on_atomic_t() pass the TASK_* mode onto its action function as an
      extra argument and make it 'unsigned int throughout.
      
      Also, consolidate a bunch of identical action functions into a default
      function that can do the appropriate thing for the mode.
      
      Also, change the argument name in the bit_wait*() function declarations to
      reflect the fact that it's the mode and not the bit number.
      
      [Peter Z gives this a grudging ACK, but thinks that the whole atomic_t wait
      should be done differently, though he's not immediately sure as to how]
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      cc: Ingo Molnar <mingo@kernel.org>
      5e4def20
    • David Howells's avatar
      Merge remote-tracking branch 'tip/timers/core' into afs-next · 81445e63
      David Howells authored
      These AFS patches need the timer_reduce() patch from timers/core.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      81445e63
    • David S. Miller's avatar
      Merge branch 'net-improve-the-process-of-redirect-and-toobig-for-ipv6-tunnels' · ede372dc
      David S. Miller authored
      Xin Long says:
      
      ====================
      net: improve the process of redirect and toobig for ipv6 tunnels
      
      Now let's say there are 3 kinds of icmp packets to process for tunnels,
      toobig(needfrag), redirect, others, their process should be:
      
       - toobig(needfrag)
         update the lower dst's pmtu by route cache, also update sk dst's pmtu
         if possible, or it will be fine if sk dst pmtu will get updated on tx
         path.
      
       - redirect
         update the lower dst's gw by route cache and return, no need to send
         this redirect packet to user sk.
      
       - others
         send the packet to user's sk, or it will also be fine to use err_count
         to count it and report fail link on tx path.
      
      All ipv4 tunnels basically follow this while some of ipv6 tunnels are
      doing in different ways, like ip6gre and ip6_tunnels update tnl dev's
      mtu instead of updating lower dst pmtu, no redirect process on their
      err_handlers, which doesn't make any sense and even causes performance
      problems.
      
      This patchset is to improve the process of redirect and toobig for ip6gre
      ip4ip6, ip6ip6 tunnels, as in ipv4 tunnels.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ede372dc
    • Xin Long's avatar
      ip6_tunnel: clean up ip4ip6 and ip6ip6's err_handlers · 77552cfa
      Xin Long authored
      This patch is to remove some useless codes of redirect and fix some
      indents on ip4ip6 and ip6ip6's err_handlers.
      
      Note that redirect icmp packet is already processed in ip6_tnl_err,
      the old redirect codes in ip4ip6_err actually never worked even
      before this patch. Besides, there's no need to send redirect to
      user's sk, it's for lower dst, so just remove it in this patch.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77552cfa
    • Xin Long's avatar
      ip6_tunnel: process toobig in a better way · b00f5432
      Xin Long authored
      The same improvement in "ip6_gre: process toobig in a better way"
      is needed by ip4ip6 and ip6ip6 as well.
      
      Note that ip4ip6 and ip6ip6 will also update sk dst pmtu in their
      err_handlers. Like I said before, gre6 could not do this as it's
      inner proto is not certain. But for all of them, sk dst pmtu will
      be updated in tx path if in need.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b00f5432
    • Xin Long's avatar
      ip6_tunnel: add the process for redirect in ip6_tnl_err · 383c1f88
      Xin Long authored
      The same process for redirect in "ip6_gre: add the process for redirect
      in ip6gre_err" is needed by ip4ip6 and ip6ip6 as well.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      383c1f88
    • Xin Long's avatar
      ip6_gre: process toobig in a better way · fe1a4ca0
      Xin Long authored
      Now ip6gre processes toobig icmp packet by setting gre dev's mtu in
      ip6gre_err, which would cause few things not good:
      
        - It couldn't set mtu with dev_set_mtu due to it's not in user context,
          which causes route cache and idev->cnf.mtu6 not to be updated.
      
        - It has to update sk dst pmtu in tx path according to gredev->mtu for
          ip6gre, while it updates pmtu again according to lower dst pmtu in
          ip6_tnl_xmit.
      
        - To change dev->mtu by toobig icmp packet is not a good idea, it should
          only work on pmtu.
      
      This patch is to process toobig by updating the lower dst's pmtu, as later
      sk dst pmtu will be updated in ip6_tnl_xmit, the same way as in ip4gre.
      
      Note that gre dev's mtu will not be updated any more, it doesn't make any
      sense to change dev's mtu after receiving a toobig packet.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe1a4ca0
    • Xin Long's avatar
      ip6_gre: add the process for redirect in ip6gre_err · 929fc032
      Xin Long authored
      This patch is to add redirect icmp packet process for ip6gre by
      calling ip6_redirect() in ip6gre_err(), as in vti6_err.
      
      Prior to this patch, there's even no route cache generated after
      receiving redirect.
      Reported-by: default avatarJianlin Shi <jishi@redhat.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      929fc032
    • Zhu Yanjun's avatar
      forcedeth: remove redudant assignments in xmit · 0d728b84
      Zhu Yanjun authored
      In xmit process, the variables are set many times. In fact,
      it is enough for these variables to be set once.
      After a long time test, the throughput performance is better
      than before.
      
      CC: Srinivas Eeda <srinivas.eeda@oracle.com>
      CC: Joe Jin <joe.jin@oracle.com>
      CC: Junxiao Bi <junxiao.bi@oracle.com>
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0d728b84
    • David S. Miller's avatar
      Merge tag 'nfc-next-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next · 6afce196
      David S. Miller authored
      Samuel Ortiz says:
      
      ====================
      NFC 4.15 pull request
      
      This is the NFC pull request for 4.15. We have:
      
      - A new netlink command for explicitly deactivating NFC targets
      - i2c constification for all NFC drivers
      - One NFC device allocation error path fix
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6afce196
    • David S. Miller's avatar
      Merge branch 'Openvswitch-meter-action' · fd9080a3
      David S. Miller authored
      Andy Zhou says:
      
      ====================
      Openvswitch meter action
      
      This patch series is the first attempt to add openvswitch
      meter support. We have previously experimented with adding
      metering support in nftables. However 1) It was not clear
      how to expose a named nftables object cleanly, and 2)
      the logic that implements metering is quite small, < 100 lines
      of code.
      
      With those two observations, it seems cleaner to add meter
      support in the openvswitch module directly.
      
      ---
      
          v1(RFC)->v2:  remove unused code improve locking
      		  and other review comments
          v2 -> v3:     rebase
          v3 -> v4:     fix undefined "__udivdi3" references on 32 bit builds.
                        use div_u64() instead.
          v4 -> v5:     rebase
      ====================
      Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd9080a3
    • Andy Zhou's avatar
      openvswitch: Add meter action support · cd8a6c33
      Andy Zhou authored
      Implements OVS kernel meter action support.
      Signed-off-by: default avatarAndy Zhou <azhou@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd8a6c33
    • Andy Zhou's avatar
      openvswitch: Add meter infrastructure · 96fbc13d
      Andy Zhou authored
      OVS kernel datapath so far does not support Openflow meter action.
      This is the first stab at adding kernel datapath meter support.
      This implementation supports only drop band type.
      Signed-off-by: default avatarAndy Zhou <azhou@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      96fbc13d
    • Andy Zhou's avatar
      openvswitch: export get_dp() API. · 9602c01e
      Andy Zhou authored
      Later patches will invoke get_dp() outside of datapath.c. Export it.
      Signed-off-by: default avatarAndy Zhou <azhou@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9602c01e
    • Andy Zhou's avatar
      openvswitch: Add meter netlink definitions · 57940406
      Andy Zhou authored
      Meter has its own netlink family. Define netlink messages and attributes
      for communicating with the user space programs.
      Signed-off-by: default avatarAndy Zhou <azhou@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      57940406
    • David S. Miller's avatar
      Merge branch 'dsa-b53-Support-prepended-Broadcom-tags' · aef1e0d5
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: dsa: b53: Support prepended Broadcom tags
      
      This patch series adds support for prepended 4-bytes Broadcom tags that we
      already support. This type of tag will typically be used when interfaced to
      a SoC like BCM58xx (NorthStar Plus) which supports a Flow Accelerator (WIP).
      In that case, we need to support a slightly different tagging format.
      
      The first patch does a bit of re-factoring and passes a port index to
      the get_tag_protocol() function since at least two different drivers need
      that type of information (mt7530, b53) to support tagging or not.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aef1e0d5
    • Florian Fainelli's avatar
      net: dsa: b53: Support prepended Broadcom tags · 11606039
      Florian Fainelli authored
      On BCM58xx devices (Northstar Plus), there is an accelerator attached to
      port 8 which would only work if we use prepended Broadcom tags. Resolve
      that difference in our get_tag_protocol() function by setting the
      appropriate tagging protocol in that case. We need to change
      b53_brcm_hdr_setup() a little bit now since we can deal with two types
      of Broadcom tags.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11606039
    • Florian Fainelli's avatar
      net: dsa: Support prepended Broadcom tag · b74b70c4
      Florian Fainelli authored
      Add a new type: DSA_TAG_PROTO_PREPEND which allows us to support for the
      4-bytes Broadcom tag that we already support, but in a format where it
      is pre-pended to the packet instead of located between the MAC SA and
      the Ethertyper (DSA_TAG_PROTO_BRCM).
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b74b70c4