1. 18 8月, 2017 1 次提交
  2. 21 6月, 2017 1 次提交
    • Y
      net: introduce __skb_put_[zero, data, u8] · de77b966
      yuan linyu 提交于
      follow Johannes Berg, semantic patch file as below,
      @@
      identifier p, p2;
      expression len;
      expression skb;
      type t, t2;
      @@
      (
      -p = __skb_put(skb, len);
      +p = __skb_put_zero(skb, len);
      |
      -p = (t)__skb_put(skb, len);
      +p = __skb_put_zero(skb, len);
      )
      ... when != p
      (
      p2 = (t2)p;
      -memset(p2, 0, len);
      |
      -memset(p, 0, len);
      )
      
      @@
      identifier p;
      expression len;
      expression skb;
      type t;
      @@
      (
      -t p = __skb_put(skb, len);
      +t p = __skb_put_zero(skb, len);
      )
      ... when != p
      (
      -memset(p, 0, len);
      )
      
      @@
      type t, t2;
      identifier p, p2;
      expression skb;
      @@
      t *p;
      ...
      (
      -p = __skb_put(skb, sizeof(t));
      +p = __skb_put_zero(skb, sizeof(t));
      |
      -p = (t *)__skb_put(skb, sizeof(t));
      +p = __skb_put_zero(skb, sizeof(t));
      )
      ... when != p
      (
      p2 = (t2)p;
      -memset(p2, 0, sizeof(*p));
      |
      -memset(p, 0, sizeof(*p));
      )
      
      @@
      expression skb, len;
      @@
      -memset(__skb_put(skb, len), 0, len);
      +__skb_put_zero(skb, len);
      
      @@
      expression skb, len, data;
      @@
      -memcpy(__skb_put(skb, len), data, len);
      +__skb_put_data(skb, data, len);
      
      @@
      expression SKB, C, S;
      typedef u8;
      identifier fn = {__skb_put};
      fresh identifier fn2 = fn ## "_u8";
      @@
      - *(u8 *)fn(SKB, S) = C;
      + fn2(SKB, C);
      Signed-off-by: Nyuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de77b966
  3. 16 6月, 2017 3 次提交
    • J
      networking: make skb_push & __skb_push return void pointers · d58ff351
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions return void * and remove all the casts across
      the tree, adding a (u8 *) cast only where the unsigned char pointer
      was used directly, all done with the following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
          @@
          expression SKB, LEN;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          @@
          - fn(SKB, LEN)[0]
          + *(u8 *)fn(SKB, LEN)
      
      Note that the last part there converts from push(...)[0] to the
      more idiomatic *(u8 *)push(...).
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d58ff351
    • J
      networking: make skb_put & friends return void pointers · 4df864c1
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions (skb_put, __skb_put and pskb_put) return void *
      and remove all the casts across the tree, adding a (u8 *) cast only
      where the unsigned char pointer was used directly, all done with the
      following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_put, __skb_put };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_put, __skb_put };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
      which actually doesn't cover pskb_put since there are only three
      users overall.
      
      A handful of stragglers were converted manually, notably a macro in
      drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
      instances in net/bluetooth/hci_sock.c. In the former file, I also
      had to fix one whitespace problem spatch introduced.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4df864c1
    • J
      networking: convert many more places to skb_put_zero() · b080db58
      Johannes Berg 提交于
      There were many places that my previous spatch didn't find,
      as pointed out by yuan linyu in various patches.
      
      The following spatch found many more and also removes the
      now unnecessary casts:
      
          @@
          identifier p, p2;
          expression len;
          expression skb;
          type t, t2;
          @@
          (
          -p = skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          |
          -p = (t)skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, len);
          |
          -memset(p, 0, len);
          )
      
          @@
          type t, t2;
          identifier p, p2;
          expression skb;
          @@
          t *p;
          ...
          (
          -p = skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          |
          -p = (t *)skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, sizeof(*p));
          |
          -memset(p, 0, sizeof(*p));
          )
      
          @@
          expression skb, len;
          @@
          -memset(skb_put(skb, len), 0, len);
          +skb_put_zero(skb, len);
      
      Apply it to the tree (with one manual fixup to keep the
      comment in vxlan.c, which spatch removed.)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b080db58
  4. 08 6月, 2017 2 次提交
  5. 02 6月, 2017 2 次提交
  6. 29 4月, 2017 1 次提交
  7. 21 4月, 2017 3 次提交
  8. 19 2月, 2017 1 次提交
  9. 13 1月, 2017 1 次提交
  10. 11 1月, 2017 1 次提交
    • S
      iw_cxgb4: do not send RX_DATA_ACK CPLs after close/abort · 3bcf96e0
      Steve Wise 提交于
      Function rx_data(), which handles ingress CPL_RX_DATA messages, was
      always sending an RX_DATA_ACK with the goal of updating the credits.
      However, if the RDMA connection is moved out of FPDU mode abruptly,
      then it is possible for iw_cxgb4 to process queued RX_DATA CPLs after HW
      has aborted the connection.  These CPLs should not trigger RX_DATA_ACKS.
      If they do, HW can see a READ after DELETE of the DB_LE hash entry for
      the tid and post a LE_DB HashTblMemCrcError.
      Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      3bcf96e0
  11. 08 10月, 2016 1 次提交
  12. 16 9月, 2016 11 次提交
  13. 04 9月, 2016 2 次提交
  14. 23 8月, 2016 2 次提交
  15. 03 8月, 2016 1 次提交
    • S
      iw_cxgb4: stop MPA_REPLY timer when disconnecting · 12eb5137
      Steve Wise 提交于
      There exists a race where the application can setup a connection
      and then disconnect it before iw_cxgb4 processes the fw4_ack
      message.  For passive side connections, the fw4_ack message is
      used to know when to stop the ep timer for MPA_REPLY messages.
      
      If the application disconnects before the fw4_ack is handled then
      c4iw_ep_disconnect() needs to clean up the timer state and stop the
      timer before restarting it for the disconnect timer.  Failure to do this
      results in a "timer already started" message and a premature stopping
      of the disconnect timer.
      
      Fixes: e4b76a2a ("RDMA/iw_cxgb4: stop_ep_timer() after MPA negotiation")
      Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      12eb5137
  16. 23 6月, 2016 4 次提交
  17. 14 5月, 2016 3 次提交
    • B
      iw_cxgb4: Convert a __force cast · ba987e51
      Bart Van Assche 提交于
      __force casts should be avoided if there is a better alternative.
      Hence modify the comparison of s_addr with INADDR_ANY such that the
      __force cast is no longer necessary.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Steve Wise <swise@opengridcomputing.com>
      Cc: Vipul Pandya <vipul@chelsio.com>
      Acked-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      ba987e51
    • H
      RDMA/iw_cxgb4: Add arp failure handlers to send_mpa_reply/reject() · 64bec74a
      Hariprasad S 提交于
      These handlers when called print error message to the kernel log,
      but the actual handling is done by _c4iw_free_ep() and process_timeout().
      Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NHariprasad Shenai <hariprasad@chelsio.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      64bec74a
    • H
      RDMA/iw_cxgb4: Always wake up waiter in c4iw_peer_abort_intr() · 093108cb
      Hariprasad S 提交于
      Currently c4iw_peer_abort_intr() does not wake up the waiter if the
      endpoint state indicates we're using MPAv2 and we're currently trying to
      connect. This was introduced with commit 7c0a33d6 ("RDMA/cxgb4:
      Don't wakeup threads for MPAv2")
      
      However, this original fix is flawed because it introduces a race that
      can cause a deadlock of the iwarp stack.  Here is the race:
      
      ->local side sets up an active offload connection.
      
      ->local side sends MPA_START request.
      
      ->peer sends MPA_START response.
      
      ->local side ingress cpl thread begins processing the MPA_START response,
      but before it changes the state from MPA_REQ_SENT to FPDU_MODE:
      
      ->peer sends a RST which results in a ABORT_REQ_RSS.  This triggers
      peer_abort_intr() which sees the state in MPA_REQ_SENT and since mpa_rev
      is 2, it will avoid waking up the endpoint with -ECONNRESET, assuming the
      stack will re-attempt the connection using MPAv1.
      
      ->Meanwhile, the cpl thread moves the state to FPDU_MODE and calls
      c4iw_modify_rc_qp() which calls rdma_init() which sends a RI_WR/INIT WR
      to firmware.  But since HW sent an abort, FW correctly drops the RI_WR/INIT
      WR.
      
      ->So the cpl thread is stuck waiting for a reply and cannot process the
      ABORT_REQ_RSS cpl sitting in its input queue. Thus everything comes to a
      halt because no more ingress cpls are processed by the stack...
      
      The correct fix for the issue is to always do the wake up in
      c4iw_abort_intr() but reinitialize the wait object in c4iw_reconnect().
      
      Fixes: 7c0a33d6 ("RDMA/cxgb4: Don't wakeup threads for MPAv2")
      Signed-off-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NHariprasad Shenai <hariprasad@chelsio.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      093108cb