1. 18 1月, 2015 3 次提交
    • J
      netlink: make nlmsg_end() and genlmsg_end() void · 053c095a
      Johannes Berg 提交于
      Contrary to common expectations for an "int" return, these functions
      return only a positive value -- if used correctly they cannot even
      return 0 because the message header will necessarily be in the skb.
      
      This makes the very common pattern of
      
        if (genlmsg_end(...) < 0) { ... }
      
      be a whole bunch of dead code. Many places also simply do
      
        return nlmsg_end(...);
      
      and the caller is expected to deal with it.
      
      This also commonly (at least for me) causes errors, because it is very
      common to write
      
        if (my_function(...))
          /* error condition */
      
      and if my_function() does "return nlmsg_end()" this is of course wrong.
      
      Additionally, there's not a single place in the kernel that actually
      needs the message length returned, and if anyone needs it later then
      it'll be very easy to just use skb->len there.
      
      Remove this, and make the functions void. This removes a bunch of dead
      code as described above. The patch adds lines because I did
      
      -	return nlmsg_end(...);
      +	nlmsg_end(...);
      +	return 0;
      
      I could have preserved all the function's return values by returning
      skb->len, but instead I've audited all the places calling the affected
      functions and found that none cared. A few places actually compared
      the return value with <= 0 in dump functionality, but that could just
      be changed to < 0 with no change in behaviour, so I opted for the more
      efficient version.
      
      One instance of the error I've made numerous times now is also present
      in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
      check for <0 or <=0 and thus broke out of the loop every single time.
      I've preserved this since it will (I think) have caused the messages to
      userspace to be formatted differently with just a single message for
      every SKB returned to userspace. It's possible that this isn't needed
      for the tools that actually use this, but I don't even know what they
      are so couldn't test that changing this behaviour would be acceptable.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      053c095a
    • J
      net: replace br_fdb_external_learn_* calls with switchdev notifier events · 3aeb6617
      Jiri Pirko 提交于
      This patch benefits from newly introduced switchdev notifier and uses it
      to propagate fdb learn events from rocker driver to bridge. That avoids
      direct function calls and possible use by other listeners (ovs).
      Suggested-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NJiri Pirko <jiri@resnulli.us>
      Signed-off-by: NScott Feldman <sfeldma@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3aeb6617
    • E
      niu: remove one compound_head() call · ff8b3356
      Eric Dumazet 提交于
      After a "page = alloc_page(mask);", we do not need to use
      compound_head() : page already points to the right place.
      
      This would be true even if using alloc_pages().
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ff8b3356
  2. 17 1月, 2015 7 次提交
  3. 16 1月, 2015 24 次提交
  4. 15 1月, 2015 5 次提交
  5. 14 1月, 2015 1 次提交
    • D
      net: hisilicon: new hip04 ethernet driver · a41ea46a
      dingtianhong 提交于
      Support Hisilicon hip04 ethernet driver, including 100M / 1000M controller.
      The controller has no tx done interrupt, reclaim xmitted buffer in the poll.
      
      v13: Fix the problem of alignment parameters for function and checkpatch warming.
      
      v12: According Alex's suggestion, modify the changelog and add MODULE_DEVICE_TABLE
           for hip04 ethernet.
      
      v11: Add ethtool support for tx coalecse getting and setting, the xmit_more
           is not supported for this patch, but I think it could work for hip04,
           will support it later after some tests for performance better.
      
           Here are some performance test results by ping and iperf(add tx_coalesce_frames/users),
           it looks that the performance and latency is more better by tx_coalesce_frames/usecs.
      
           - Before:
           $ ping 192.168.1.1 ...
           === 192.168.1.1 ping statistics ===
           24 packets transmitted, 24 received, 0% packet loss, time 22999ms
           rtt min/avg/max/mdev = 0.180/0.202/0.403/0.043 ms
      
           $ iperf -c 192.168.1.1 ...
           [ ID] Interval       Transfer     Bandwidth
           [  3]  0.0- 1.0 sec   115 MBytes   945 Mbits/sec
      
           - After:
           $ ping 192.168.1.1 ...
           === 192.168.1.1 ping statistics ===
           24 packets transmitted, 24 received, 0% packet loss, time 22999ms
           rtt min/avg/max/mdev = 0.178/0.190/0.380/0.041 ms
      
           $ iperf -c 192.168.1.1 ...
           [ ID] Interval       Transfer     Bandwidth
           [  3]  0.0- 1.0 sec   115 MBytes   965 Mbits/sec
      
      v10: According David Miller and Arnd Bergmann's suggestion, add some modification
           for v9 version
           - drop the workqueue
           - batch cleanup based on tx_coalesce_frames/usecs for better throughput
           - use a reasonable default tx timeout (200us, could be shorted
             based on measurements) with a range timer
           - fix napi poll function return value
           - use a lockless queue for cleanup
      Signed-off-by: NZhangfei Gao <zhangfei.gao@linaro.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a41ea46a