1. 17 Dec, 2008 1 commit
  2. 16 Dec, 2008 39 commits
    • Julia Lawall's avatar
      drivers/net/hamradio: Move a dereference below a NULL test · f40e0638
      Julia Lawall authored
      In each case, if the NULL test is necessary, then the dereference should be
      moved below the NULL test.
      
      The semantic patch that makes this change is as follows:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @@
      type T;
      expression E;
      identifier i,fld;
      statement S;
      @@
      
      - T i = E->fld;
      + T i;
        ... when != E
            when != i
        if (E == NULL) S
      + i = E->fld;
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f40e0638
    • Andy Fleming's avatar
      phylib: Remove unnecessary "reset" fixups in genphy_setup_forced · f162e97d
      Andy Fleming authored
      genphy_setup_forced hasn't actually reset the PHY for a long time,
      but a comment to that effect remained in the code, so code continued
      to act as if it *had* reset the PHY, and called the necessary fixup
      functions to respond to a PHY reset.  With no reset, those functions
      are no longer needed, so we remove them.
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f162e97d
    • Dai Haruki's avatar
      gianfar: Make all BD status writes 32-bit · 5a5efed4
      Dai Haruki authored
      Whenever we want to update the status field in a BD, we usually want to
      update the length field, too.  By combining them into one 32-bit field, we
      reduce the number of stores to memory shared with the controller, and we
      eliminate the need for order-enforcement, as the length and "READY" bit are
      now updated atomically at the same time.
      Signed-off-by: default avatarDai Haruki <Dai.Haruki@freescale.com>
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a5efed4
    • Andy Fleming's avatar
      gianfar: Add macros for stepping through BDs · 31de198b
      Andy Fleming authored
      This code is based strongly on code from Dai Haruki <Dai.Haruki@freescale.com>.
      
      The gianfar Buffer Descriptors are arranged in a circular array, the end of
      which is denoted by setting the "WRAP" bit in the descriptor.  However, the
      software knows the end of the ring because it knows how many descriptors are
      there.  Rather than check each descriptor for whether the WRAP bit is set,
      use pointer math to determine where the next BD is.  This is also useful for
      when we want to look at BDs other than the very next one (for Scatter-Gather).
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31de198b
    • Dai Haruki's avatar
      gianfar: Remove unused gfar_add_fcb() function parameter · a22823e7
      Dai Haruki authored
      - Also, use cacheable_memzero instead of memset for performance reasons.
      Signed-off-by: default avatarDai Haruki <dai.haruki@freescale.com>
      Acked-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a22823e7
    • Dai Haruki's avatar
      gianfar: Enable padding and Optimize the frame prepended bytes handling · 2c2db48a
      Dai Haruki authored
      The eTSEC can prepend up to 32 bytes to a received frame, usually for the
      purpose of aligning the IP address to a word boundary, so this turns it on.
      
      While we're in there, make the handling of the pre-frame bytes (padding and
      Frame Control Block) cleaner.
      Signed-off-by: default avatarDai Haruki <dai.haruki@freescale.com>
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c2db48a
    • Dai Haruki's avatar
      gianfar: Fix VLAN HW feature related frame/buffer size calculation. · 77ecaf2d
      Dai Haruki authored
      Optimize the VLAN checking logic as well.
      Signed-off-by: default avatarDai Haruki <dai.haruki@freescale.com>
      Acked-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77ecaf2d
    • Dai Haruki's avatar
      gianfar: Fix eTSEC configuration procedure · 12dea57b
      Dai Haruki authored
      Fix some bugs in the ethtool configuration functions:
      * gfar_clean_rx_ring should not be called with interrupts disabled.
      * Update last transmission time to avoid tx timeout.
      * Delete redundant NETIF_F_IP_CSUM check in gfar_start_xmit
      * Use netif_tx_lock_bh when reconfiguring the tx csum
      Signed-off-by: default avatarDai Haruki <dai.haruki@freescale.com>
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      12dea57b
    • Dai Haruki's avatar
      gianfar: Optimize interrupt coalescing configuration · b46a8454
      Dai Haruki authored
      Store the interrupt coalescing values in the form in which they will be
      written to the interrupt coalescing registers.  This puts a little overhead
      into the ethtool configuration, and takes it out of the interrupt handler
      Signed-off-by: default avatarDai Haruki <dai.haruki@freescale.com>
      Acked-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b46a8454
    • Andy Fleming's avatar
      gianfar: Convert gianfar to an of_platform_driver · b31a1d8b
      Andy Fleming authored
      Does the same for the accompanying MDIO driver, and then modifies the TBI
      configuration method.  The old way used fields in einfo, which no longer
      exists.  The new way is to create an MDIO device-tree node for each instance
      of gianfar, and create a tbi-handle property to associate ethernet controllers
      with the TBI PHYs they are connected to.
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b31a1d8b
    • Andy Fleming's avatar
      gianfar: Use gfar_halt to stop DMA in gfar_probe · 257d938a
      Andy Fleming authored
      gfar_halt does everything we want to do there, including disabling
      TX/RX.  It also doesn't unnecessarily enable DMA if it's already
      stopped.
      Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      257d938a
    • Sakari Ailus's avatar
      tlan: Remove broken support for big buffers · 5eeabf51
      Sakari Ailus authored
      The big rx/tx buffer support is broken and unlikely to be very useful
      as such. Remove it.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5eeabf51
    • David S. Miller's avatar
      Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 · 354ade90
      David S. Miller authored
      Conflicts:
      
      	drivers/net/enc28j60.c
      354ade90
    • Sakari Ailus's avatar
      tlan: Fix pci memory unmapping · bb5f133d
      Sakari Ailus authored
      Fix pci unmapping problem introduced by commit id
      8953f128 "tlan: Fix small (< 64 bytes)
      datagram transmissions".
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb5f133d
    • Yang Hongyang's avatar
      ipv6: fix the outgoing interface selection order in udpv6_sendmsg() · 9f690db7
      Yang Hongyang authored
      1.When no interface is specified in an IPV6_PKTINFO ancillary data
        item, the interface specified in an IPV6_PKTINFO sticky optionis 
        is used.
      
      RFC3542:
      6.7.  Summary of Outgoing Interface Selection
      
         This document and [RFC-3493] specify various methods that affect the
         selection of the packet's outgoing interface.  This subsection
         summarizes the ordering among those in order to ensure deterministic
         behavior.
      
         For a given outgoing packet on a given socket, the outgoing interface
         is determined in the following order:
      
         1. if an interface is specified in an IPV6_PKTINFO ancillary data
            item, the interface is used.
      
         2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
            option, the interface is used.
      Signed-off-by: default avatarYang Hongyang <yanghy@cn.fujitsu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9f690db7
    • Yang Hongyang's avatar
      ipv6: fix the return interface index when get it while no message is received · f250dcda
      Yang Hongyang authored
      When get receiving interface index while no message is received,
      the the value seted with setsockopt() should be returned.
      
      RFC 3542:
         Issuing getsockopt() for the above options will return the sticky
         option value i.e., the value set with setsockopt().  If no sticky
         option value has been set getsockopt() will return the following
         values:
      
         -  For the IPV6_PKTINFO option, it will return an in6_pktinfo
            structure with ipi6_addr being in6addr_any and ipi6_ifindex being
            zero.
      Signed-off-by: default avatarYang Hongyang <yanghy@cn.fujitsu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f250dcda
    • Yang Hongyang's avatar
      ipv6: Add IPV6_PKTINFO sticky option support to setsockopt() · b24a2516
      Yang Hongyang authored
      There are three reasons for me to add this support:
      1.When no interface is specified in an IPV6_PKTINFO ancillary data
        item, the interface specified in an IPV6_PKTINFO sticky optionis 
        is used.
      
      RFC3542:
      6.7.  Summary of Outgoing Interface Selection
      
         This document and [RFC-3493] specify various methods that affect the
         selection of the packet's outgoing interface.  This subsection
         summarizes the ordering among those in order to ensure deterministic
         behavior.
      
         For a given outgoing packet on a given socket, the outgoing interface
         is determined in the following order:
      
         1. if an interface is specified in an IPV6_PKTINFO ancillary data
            item, the interface is used.
      
         2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
            option, the interface is used.
      
      2.When no IPV6_PKTINFO ancillary data is received,getsockopt() should 
        return the sticky option value which set with setsockopt().
      
      RFC 3542:
         Issuing getsockopt() for the above options will return the sticky
         option value i.e., the value set with setsockopt().  If no sticky
         option value has been set getsockopt() will return the following
         values:
      
      3.Make the setsockopt implementation POSIX compliant.
      Signed-off-by: default avatarYang Hongyang <yanghy@cn.fujitsu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b24a2516
    • Steve Glendinning's avatar
      net: Refactor full duplex flow control resolution · bc02ff95
      Steve Glendinning authored
      These 4 drivers have identical full duplex flow control resolution
      functions.  This patch changes them all to use one common function.
      
      The function in question decides whether a device should enable TX and
      RX flow control in a standard way (IEEE 802.3-2005 table 28B-3), so this
      should also be useful for other drivers.
      Signed-off-by: default avatarSteve Glendinning <steve.glendinning@smsc.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bc02ff95
    • Steve Glendinning's avatar
      net: Move flow control definitions to mii.h · e18ce346
      Steve Glendinning authored
      flags used within drivers for indicating tx and rx flow control are
      defined in 4 drivers (and probably more), move these constants to mii.h.
      
      The 3 SMSC drivers use the same constants (FLOW_CTRL_TX), but TG3 uses
      TG3_FLOW_CTRL_TX, so this patch also renames the constants within TG3.
      Signed-off-by: default avatarSteve Glendinning <steve.glendinning@smsc.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e18ce346
    • Alexey Dobriyan's avatar
      f9867328
    • Divy Le Ray's avatar
      cxgb3: untie strict FW matching · 8207befa
      Divy Le Ray authored
      The NIC driver can work with mutliple versions of the FW.
      Let the driver load when the embedded FW does not match,
      and the FW update mechanism failed.
      The iWARP module will make its own loading decision.
      Signed-off-by: default avatarDivy Le Ray <divy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8207befa
    • Baruch Siach's avatar
      enc28j60: use netif_rx_ni() to deliver RX packets · 2c413a64
      Baruch Siach authored
      The enc28j60 driver reads incoming packets in the process (workqueue) context,
      not in a tasklet or the interrupt context.  Thus, we should use netif_rx_ni()
      to deliver those packets to the networking layer, instead of netif_rx(). This
      way incoming packets don't wait in the incoming queue for the next IRQ to be
      serviced.
      Signed-off-by: default avatarBaruch Siach <baruch@tkos.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c413a64
    • Sakari Ailus's avatar
      tlan: Fix small (< 64 bytes) datagram transmissions · 8953f128
      Sakari Ailus authored
      The TLAN chip does not support tranmissions smaller than 64
      bytes. Smaller transfers need to be padded up to that size. This was
      broken by commit id 41873e9a ("tlan:
      get rid of padding buffer").
      
      <URL:http://bugzilla.kernel.org/show_bug.cgi?id=11754>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8953f128
    • Oliver Hartkopp's avatar
      5ad258c0
    • James Chapman's avatar
      l2tp: fix UDP checksum support · ffcebb16
      James Chapman authored
      The pppol2tp driver has had broken UDP checksum code for a long
      time. This patch fixes it. If UDP checksums are enabled in the
      tunnel's UDP socket, the L2TP driver now properly validates the
      checksum on receive and fills in the checksum on transmit. If the
      network device has hardware checksum support and is enabled, it is
      used instead of generating/checking the checksum in software.
      Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffcebb16
    • Pablo Neira Ayuso's avatar
      netfilter: ctnetlink: fix missing CTA_NAT_SEQ_UNSPEC · 092cab7e
      Pablo Neira Ayuso authored
      This patch fixes an inconsistency in nfnetlink_conntrack.h that
      I introduced myself. The problem is that CTA_NAT_SEQ_UNSPEC is
      missing from enum ctattr_natseq. This inconsistency may lead to
      problems in the message parsing in userspace (if the message
      contains the CTA_NAT_SEQ_* attributes, of course).
      
      This patch breaks backward compatibility, however, the only known
      client of this code is libnetfilter_conntrack which indeed crashes
      because it assumes the existence of CTA_NAT_SEQ_UNSPEC to do
      the parsing.
      
      The CTA_NAT_SEQ_* attributes were introduced in 2.6.25.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      092cab7e
    • Rémi Denis-Courmont's avatar
    • Hannes Eder's avatar
      isdn: eicon: fix sparse warning: make global functions static · 4ee59d54
      Hannes Eder authored
      Fix this sparse warnings by making the functions static:
      
        drivers/isdn/hardware/eicon/di.c:356:6: warning: symbol 'isdn_rc' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/di.c:558:6: warning: symbol 'isdn_ind' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:595:6: warning: symbol 'api_parse' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:634:6: warning: symbol 'api_save_msg' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:666:6: warning: symbol 'api_load_msg' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:3417:6: warning: symbol 'manufacturer_req' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:3745:6: warning: symbol 'manufacturer_res' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:4077:6: warning: symbol 'control_rc' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:4743:6: warning: symbol 'data_rc' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:4779:6: warning: symbol 'data_ack' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:4805:6: warning: symbol 'sig_ind' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:6173:6: warning: symbol 'SendInfo' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:6349:6: warning: symbol 'SendMultiIE' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:6468:6: warning: symbol 'nl_ind' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:7250:6: warning: symbol 'get_plci' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:7409:6: warning: symbol 'add_d' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:7427:6: warning: symbol 'add_ai' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:7448:6: warning: symbol 'add_b1' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:7912:6: warning: symbol 'add_b23' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:8709:6: warning: symbol 'nl_req_ncci' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:8731:6: warning: symbol 'send_req' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:8866:6: warning: symbol 'listen_check' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:8909:6: warning: symbol 'IndParse' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:8994:6: warning: symbol 'ie_compare' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:9003:6: warning: symbol 'find_cip' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:9071:6: warning: symbol 'SetVoiceChannel' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:9089:6: warning: symbol 'VoiceChannelOff' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:9102:6: warning: symbol 'AdvCodecSupport' was not declared. Should it be static?
        drivers/isdn/hardware/eicon/message.c:9198:6: warning: symbol 'CodecIdCheck' was not declared. Should it be static?
      Signed-off-by: default avatarHannes Eder <hannes@hanneseder.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ee59d54
    • Ilpo Järvinen's avatar
      ipmr: merge common code · b1879204
      Ilpo Järvinen authored
      Also removes redundant skb->len < x check which can't
      be true once pskb_may_pull(skb, x) succeeded.
      
      $ diff-funcs pim_rcv ipmr.c ipmr.c pim_rcv_v1
        --- ipmr.c:pim_rcv()
        +++ ipmr.c:pim_rcv_v1()
      @@ -1,22 +1,27 @@
      -static int pim_rcv(struct sk_buff * skb)
      +int pim_rcv_v1(struct sk_buff * skb)
       {
      -	struct pimreghdr *pim;
      +	struct igmphdr *pim;
       	struct iphdr   *encap;
       	struct net_device  *reg_dev = NULL;
      
       	if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
       		goto drop;
      
      -	pim = (struct pimreghdr *)skb_transport_header(skb);
      -	if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
      -	    (pim->flags&PIM_NULL_REGISTER) ||
      -	    (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
      -	     csum_fold(skb_checksum(skb, 0, skb->len, 0))))
      +	pim = igmp_hdr(skb);
      +
      +	if (!mroute_do_pim ||
      +	    skb->len < sizeof(*pim) + sizeof(*encap) ||
      +	    pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
       		goto drop;
      
      -	/* check if the inner packet is destined to mcast group */
       	encap = (struct iphdr *)(skb_transport_header(skb) +
      -				 sizeof(struct pimreghdr));
      +				 sizeof(struct igmphdr));
      +	/*
      +	   Check that:
      +	   a. packet is really destinted to a multicast group
      +	   b. packet is not a NULL-REGISTER
      +	   c. packet is not truncated
      +	 */
       	if (!ipv4_is_multicast(encap->daddr) ||
       	    encap->tot_len == 0 ||
       	    ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
      @@ -40,9 +45,9 @@
       	skb->ip_summed = 0;
       	skb->pkt_type = PACKET_HOST;
       	dst_release(skb->dst);
      +	skb->dst = NULL;
       	reg_dev->stats.rx_bytes += skb->len;
       	reg_dev->stats.rx_packets++;
      -	skb->dst = NULL;
       	nf_reset(skb);
       	netif_rx(skb);
       	dev_put(reg_dev);
      
      $ codiff net/ipv4/ipmr.o.old net/ipv4/ipmr.o.new
      
      net/ipv4/ipmr.c:
        pim_rcv_v1 | -283
        pim_rcv    | -284
       2 functions changed, 567 bytes removed
      
      net/ipv4/ipmr.c:
        __pim_rcv | +307
       1 function changed, 307 bytes added
      
      net/ipv4/ipmr.o.new:
       3 functions changed, 307 bytes added, 567 bytes removed, diff: -260
      
      (Tested on x86_64).
      
      It seems that pimlen arg could be left out as well and
      eq-sizedness of structs trapped with BUILD_BUG_ON but
      I don't think that's more than a cosmetic flaw since there
      aren't that many args anyway.
      
      Compile tested.
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b1879204
    • Ilpo Järvinen's avatar
    • Divy Le Ray's avatar
      cxgb3: Add multiple Tx queue support. · 82ad3329
      Divy Le Ray authored
      Implement NIC Tx multiqueue.
      Bump up driver version.
      Signed-off-by: default avatarDivy Le Ray <divy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82ad3329
    • Herbert Xu's avatar
      e1000e: Add GRO support · 89c88b16
      Herbert Xu authored
      This patch adds GRO support to e1000e by making it invoke napi_gro_receive
      instead of netif_receive_skb.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89c88b16
    • Herbert Xu's avatar
      ethtool: Add GGRO and SGRO ops · b240a0e5
      Herbert Xu authored
      This patch adds the ethtool ops to enable and disable GRO.  It also
      makes GRO depend on RX checksum offload much the same as how TSO
      depends on SG support.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b240a0e5
    • Herbert Xu's avatar
      tcp: Add GRO support · bf296b12
      Herbert Xu authored
      This patch adds the TCP-specific portion of GRO.  The criterion for
      merging is extremely strict (the TCP header must match exactly apart
      from the checksum) so as to allow refragmentation.  Otherwise this
      is pretty much identical to LRO, except that we support the merging
      of ECN packets.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf296b12
    • Herbert Xu's avatar
      net: Add skb_gro_receive · 71d93b39
      Herbert Xu authored
      This patch adds the helper skb_gro_receive to merge packets for
      GRO.  The current method is to allocate a new header skb and then
      chain the original packets to its frag_list.  This is done to
      make it easier to integrate into the existing GSO framework.
      
      In future as GSO is moved into the drivers, we can undo this and
      simply chain the original packets together.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71d93b39
    • Herbert Xu's avatar
      ipv4: Add GRO infrastructure · 73cc19f1
      Herbert Xu authored
      This patch adds GRO support for IPv4.
      
      The criteria for merging is more stringent than LRO, in particular,
      we require all fields in the IP header to be identical except for
      the length, ID and checksum.  In addition, the ID must form an
      arithmetic sequence with a difference of one.
      
      The ID requirement might seem overly strict, however, most hardware
      TSO solutions already obey this rule.  Linux itself also obeys this
      whether GSO is in use or not.
      
      In future we could relax this rule by storing the IDs (or rather
      making sure that we don't drop them when pulling the aggregate
      skb's tail).
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73cc19f1
    • Herbert Xu's avatar
      net: Add Generic Receive Offload infrastructure · d565b0a1
      Herbert Xu authored
      This patch adds the top-level GRO (Generic Receive Offload) infrastructure.
      This is pretty similar to LRO except that this is protocol-independent.
      Instead of holding packets in an lro_mgr structure, they're now held in
      napi_struct.
      
      For drivers that intend to use this, they can set the NETIF_F_GRO bit and
      call napi_gro_receive instead of netif_receive_skb or just call netif_rx.
      The latter will call napi_receive_skb automatically.  When napi_gro_receive
      is used, the driver must either call napi_complete/napi_rx_complete, or
      call napi_gro_flush in softirq context if the driver uses the primitives
      __napi_complete/__napi_rx_complete.
      
      Protocols will set the gro_receive and gro_complete function pointers in
      order to participate in this scheme.
      
      In addition to the packet, gro_receive will get a list of currently held
      packets.  Each packet in the list has a same_flow field which is non-zero
      if it is a potential match for the new packet.  For each packet that may
      match, they also have a flush field which is non-zero if the held packet
      must not be merged with the new packet.
      
      Once gro_receive has determined that the new skb matches a held packet,
      the held packet may be processed immediately if the new skb cannot be
      merged with it.  In this case gro_receive should return the pointer to
      the existing skb in gro_list.  Otherwise the new skb should be merged into
      the existing packet and NULL should be returned, unless the new skb makes
      it impossible for any further merges to be made (e.g., FIN packet) where
      the merged skb should be returned.
      
      Whenever the skb is merged into an existing entry, the gro_receive
      function should set NAPI_GRO_CB(skb)->same_flow.  Note that if an skb
      merely matches an existing entry but can't be merged with it, then
      this shouldn't be set.
      
      If gro_receive finds it pointless to hold the new skb for future merging,
      it should set NAPI_GRO_CB(skb)->flush.
      
      Held packets will be flushed by napi_gro_flush which is called by
      napi_complete and napi_rx_complete.
      
      Currently held packets are stored in a singly liked list just like LRO.
      The list is limited to a maximum of 8 entries.  In future, this may be
      expanded to use a hash table to allow more flows to be held for merging.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d565b0a1
    • Herbert Xu's avatar
      net: Add frag_list support to GSO · 1a881f27
      Herbert Xu authored
      This patch allows GSO to handle frag_list in a limited way for the
      purposes of allowing packets merged by GRO to be refragmented on
      output.
      
      Most hardware won't (and aren't expected to) support handling GRO
      frag_list packets directly.  Therefore we will perform GSO in
      software for those cases.
      
      However, for drivers that can support it (such as virtual NICs) we
      may not have to segment the packets at all.
      
      Whether the added overhead of GRO/GSO is worthwhile for bridges
      and routers when weighed against the benefit of potentially
      increasing the MTU within the host is still an open question.
      However, for the case of host nodes this is undoubtedly a win.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a881f27
    • Herbert Xu's avatar
      net: Add frag_list support to skb_segment · 89319d38
      Herbert Xu authored
      This patch adds limited support for handling frag_list packets in
      skb_segment.  The intention is to support GRO (Generic Receive Offload)
      packets which will be constructed by chaining normal packets using
      frag_list.
      
      As such we require all frag_list members terminate on exact MSS
      boundaries.  This is checked using BUG_ON.
      
      As there should only be one producer in the kernel of such packets,
      namely GRO, this requirement should not be difficult to maintain.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89319d38