1. 21 Nov, 2016 19 commits
  2. 20 Nov, 2016 4 commits
    • Alexey Dobriyan's avatar
      net: fix bogus cast in skb_pagelen() and use unsigned variables · c72d8cda
      Alexey Dobriyan authored
      1) cast to "int" is unnecessary:
         u8 will be promoted to int before decrementing,
         small positive numbers fit into "int", so their values won't be changed
         during promotion.
      
         Once everything is int including loop counters, signedness doesn't
         matter: 32-bit operations will stay 32-bit operations.
      
         But! Someone tried to make this loop smart by making everything of
         the same type apparently in an attempt to optimise it.
         Do the optimization, just differently.
         Do the cast where it matters. :^)
      
      2) frag size is unsigned entity and sum of fragments sizes is also
         unsigned.
      
      Make everything unsigned, leave no MOVSX instruction behind.
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4 (-4)
      	function                                     old     new   delta
      	skb_cow_data                                 835     834      -1
      	ip_do_fragment                              2549    2548      -1
      	ip6_fragment                                3130    3128      -2
      	Total: Before=154865032, After=154865028, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c72d8cda
    • Alexey Dobriyan's avatar
      netlink: smaller nla_attr_minlen table · 32d84cdc
      Alexey Dobriyan authored
      Length of a netlink attribute may be u16 but lengths of basic attributes
      are much smaller, so small we can save 16 bytes of .rodata and pocket
      change inside .text.
      
      16-bit is worse on x86-64 than 8-bit because of operand size override prefix.
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-19 (-19)
      	function                                     old     new   delta
      	validate_nla                                 418     417      -1
      	nla_policy_len                                66      64      -2
      	nla_attr_minlen                               32      16     -16
      	Total: Before=154865051, After=154865032, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      32d84cdc
    • Alexey Dobriyan's avatar
      netlink: use "unsigned int" in nla_next() · 3b2c75d3
      Alexey Dobriyan authored
      ->nla_len is unsigned entity (it's length after all) and u16,
      thus it can't overflow when being aligned into int/unsigned int.
      
      (nlmsg_next has the same code, but I didn't yet convince myself
      it is correct to do so).
      
      There is pointer arithmetic in this function and offset being
      unsigned is better:
      
      	add/remove: 0/0 grow/shrink: 1/64 up/down: 5/-309 (-304)
      	function                                     old     new   delta
      	nl80211_set_wiphy                           1444    1449      +5
      	team_nl_cmd_options_set                      997     995      -2
      	tcf_em_tree_validate                         872     870      -2
      	switchdev_port_bridge_setlink                352     350      -2
      	switchdev_port_br_afspec                     312     310      -2
      	rtm_to_fib_config                            428     426      -2
      	qla4xxx_sysfs_ddb_set_param                 2193    2191      -2
      	qla4xxx_iface_set_param                     4470    4468      -2
      	ovs_nla_free_flow_actions                    152     150      -2
      	output_userspace                             518     516      -2
      		...
      	nl80211_set_reg                              654     649      -5
      	validate_scan_freqs                          148     142      -6
      	validate_linkmsg                             288     282      -6
      	nl80211_parse_connkeys                       489     483      -6
      	nlattr_set                                   231     224      -7
      	nf_tables_delsetelem                         267     260      -7
      	do_setlink                                  3416    3408      -8
      	netlbl_cipsov4_add_std                      1672    1659     -13
      	nl80211_parse_sched_scan                    2902    2888     -14
      	nl80211_trigger_scan                        1738    1720     -18
      	do_execute_actions                          2821    2738     -83
      	Total: Before=154865355, After=154865051, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b2c75d3
    • Alexey Dobriyan's avatar
      net: make struct napi_alloc_cache::skb_count unsigned int · e0d7924a
      Alexey Dobriyan authored
      size_t is way too much for an integer not exceeding 64.
      
      Space savings: 10 bytes!
      
      	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10 (-10)
      	function                                     old     new   delta
      	napi_consume_skb                             165     163      -2
      	__kfree_skb_flush                             56      53      -3
      	__kfree_skb_defer                             97      92      -5
      	Total: Before=154865639, After=154865629, chg -0.00%
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0d7924a
  3. 19 Nov, 2016 6 commits
  4. 18 Nov, 2016 11 commits
    • Hariprasad Shenai's avatar
      cxgb4: Allocate Tx queues dynamically · ab677ff4
      Hariprasad Shenai authored
      Allocate resources dynamically for Upper layer driver's (ULD) like
      cxgbit, iw_cxgb4, cxgb4i and chcr. The resources allocated include Tx
      queues which are allocated when ULD register with cxgb4 driver and freed
      while un-registering. The Tx queues which are shared by ULD shall be
      allocated by first registering driver and un-allocated by last
      unregistering driver.
      Signed-off-by: default avatarAtul Gupta <atul.gupta@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab677ff4
    • Dan Carpenter's avatar
      liquidio CN23XX: bitwise vs logical AND typo · c816061d
      Dan Carpenter authored
      We obviously intended a bitwise AND here, not a logical one.
      
      Fixes: 8c978d05 ("liquidio CN23XX: Mailbox support")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c816061d
    • Woojung Huh's avatar
      lan78xx: relocate mdix setting to phy driver · f6e3ef3e
      Woojung Huh authored
      Relocate mdix code to phy driver to be called at config_init().
      Signed-off-by: default avatarWoojung Huh <woojung.huh@microchip.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6e3ef3e
    • David S. Miller's avatar
      Merge branch 'net-marvell-freescale-compile-test' · 82e527df
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: Enable COMPILE_TEST for Marvell & Freescale drivers
      
      This patch series allows building the Freescale and Marvell Ethernet network
      drivers with COMPILE_TEST.
      
      Changes in v4:
      
      - add proper HAS_DMA to fix build errors on m32r
      - provide an inline stub for mvebu_mbus_get_dram_win_info
      - added an additional patch to fix build errors with mv88e6xxx on m32r
      
      Changes in v3:
      
      - reorder patches to avoid introducing a build warning between commits
      
      Changes in v2:
      
      - rename register define clash when building for i386 (spotted by LKP)
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82e527df
    • Florian Fainelli's avatar
      net: dsa: mv88e6xxx: Select IRQ_DOMAIN · 0717b876
      Florian Fainelli authored
      Some architectures may not define IRQ_DOMAIN (like m32r), fixes
      undefined references to IRQ_DOMAIN functions.
      
      Fixes: dc30c35b ("net: dsa: mv88e6xxx: Implement interrupt support.")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0717b876
    • Florian Fainelli's avatar
      net: marvell: Allow drivers to be built with COMPILE_TEST · a0627f77
      Florian Fainelli authored
      All Marvell Ethernet drivers actually build fine with COMPILE_TEST with
      a few warnings. We need to add a few HAS_DMA dependencies to fix linking
      failures on problematic architectures like m32r.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0627f77
    • Florian Fainelli's avatar
      bus: mvebu-bus: Provide inline stub for mvebu_mbus_get_dram_win_info · 603ab573
      Florian Fainelli authored
      In preparation for allowing CONFIG_MVNETA_BM to build with COMPILE_TEST,
      provide an inline stub for mvebu_mbus_get_dram_win_info().
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      603ab573
    • Florian Fainelli's avatar
      net: fsl: Allow most drivers to be built with COMPILE_TEST · 0827be21
      Florian Fainelli authored
      There are only a handful of Freescale Ethernet drivers that don't
      actually build with COMPILE_TEST:
      
      * FEC, for which we would need to define a default register layout if no
        supported architecture is defined
      
      * UCC_GETH which depends on PowerPC cpm.h header (which could be moved
        to a generic location)
      
      * GIANFAR needs to depend on HAS_DMA to fix linking failures on some
        architectures (like m32r)
      
      We need to fix an unmet dependency to get there though:
      warning: (FSL_XGMAC_MDIO) selects OF_MDIO which has unmet direct
      dependencies (OF && PHYLIB)
      
      which would result in CONFIG_OF_MDIO=[ym] without CONFIG_OF to be set.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0827be21
    • Florian Fainelli's avatar
      net: gianfar_ptp: Rename FS bit to FIPERST · 00a19e55
      Florian Fainelli authored
      FS is a global symbol used by the x86 32-bit architecture, fixes builds
      re-definitions:
      
      >> drivers/net/ethernet/freescale/gianfar_ptp.c:75:0: warning: "FS"
      >> redefined
          #define FS                    (1<<28) /* FIPER start indication */
      
         In file included from arch/x86/include/uapi/asm/ptrace.h:5:0,
                          from arch/x86/include/asm/ptrace.h:6,
                          from arch/x86/include/asm/math_emu.h:4,
                          from arch/x86/include/asm/processor.h:11,
                          from include/linux/mutex.h:19,
                          from include/linux/kernfs.h:13,
                          from include/linux/sysfs.h:15,
                          from include/linux/kobject.h:21,
                          from include/linux/device.h:17,
                          from
      drivers/net/ethernet/freescale/gianfar_ptp.c:23:
         arch/x86/include/uapi/asm/ptrace-abi.h:15:0: note: this is the
      location of the previous definition
          #define FS 9
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      00a19e55
    • Lendacky, Thomas's avatar
      amd-xgbe: Update connection validation for backplane mode · 5a4e4c8f
      Lendacky, Thomas authored
      Update the connection type enumeration for backplane mode and return
      an error when there is a mismatch between the mode and the connection
      type.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a4e4c8f
    • David S. Miller's avatar
      Merge branch 'ethtool-phy-downshift' · d3c19c0a
      David S. Miller authored
      Allan W. Nielsen says:
      
      ====================
      Adding PHY-Tunables and downshift support
      
      (This is a re-post of the v3 patch set with a new cover letter - I was not
      aware that the cover letters was used a commit comments in merge commits).
      
      This series add support for PHY tunables, and uses this facility to
      configure downshifting. The downshifting mechanism is implemented for MSCC
      phys.
      
      This series tries to address the comments provided back in mid October when
      this feature was posted along with fast-link-failure. Fast-link-failure has
      been separated out, but we would like to pick continue on that if/when we
      agree on how the phy-tunables and downshifting should be done.
      
      The proposed generic interface is similar to
      ETHTOOL_GTUNABLE/ETHTOOL_STUNABLE, it uses the same type
      (ethtool_tunable/tunable_type_id) but a new enum (phy_tunable_id) is added
      to reflect the PHY tunable.
      
      The implementation just call the newly added function pointers in
      get_tunable/set_tunable phy_device structure.
      
      To configure downshifting, the ethtool_tunable structure is used. 'id' must
      be set to 'ETHTOOL_PHY_DOWNSHIFT', 'type_id' must be set to
      'ETHTOOL_TUNABLE_U8' and 'data' value configure the amount of downshift
      re-tries.
      
      If configured to DOWNSHIFT_DEV_DISABLE, then downshift is disabled If
      configured to DOWNSHIFT_DEV_DEFAULT_COUNT, then it is up to the device to
      choose a device-specific re-try count.
      
      Tested on Beaglebone Black with VSC 8531 PHY.
      
      Change set:
      v0:
      
      - Link Speed downshift and Fast Link failure-2 features coded by using
        Device tree.
      v1:
      - Split the Downshift and FLF2 features in different set of patches.
      - Removed DT access and implemented IOCTL access suggested by Andrew.
      - Added function pointers in get_tunable/set_tunable phy_device structure
      v2:
      - Added trace message with a hist is printed when downshifting clould not
        be eanbled with the requested count
      - (ethtool) Syntax is changed from "--set-phy-tunable downshift on|off|%d"
        to "--set-phy-tunable [downshift on|off [count N]]" - as requested by
        Andrew.
      v3:
      - Fixed Spelling in "net: phy: Add downshift get/set support in Microsemi
        PHYs driver"
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d3c19c0a