libcxgb,cxgb4: use __skb_put_zero to simplfy code
authorYueHaibing <yuehaibing@huawei.com>
Sat, 28 Apr 2018 04:35:22 +0000 (12:35 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2018 15:53:48 +0000 (11:53 -0400)
use helper __skb_put_zero to replace the pattern of __skb_put() && memset()

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/chelsio/cxgb4/srq.c
drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h

index db92f1858060ec685d7b59740ada8422097f178f..aae980205eceb605c491132c1e1f6b795c79e6bb 100644 (file)
@@ -64,8 +64,7 @@ static int set_tcb_field(struct adapter *adap, struct filter_entry *f,
        if (!skb)
                return -ENOMEM;
 
-       req = (struct cpl_set_tcb_field *)__skb_put(skb, sizeof(*req));
-       memset(req, 0, sizeof(*req));
+       req = (struct cpl_set_tcb_field *)__skb_put_zero(skb, sizeof(*req));
        INIT_TP_WR_CPL(req, CPL_SET_TCB_FIELD, ftid);
        req->reply_ctrl = htons(REPLY_CHAN_V(0) |
                                QUEUENO_V(adap->sge.fw_evtq.abs_id) |
index 6228a570830797977f70acead3e88ba793c9c277..82b70a565e248aa208a95c5d5973da42ad3711c7 100644 (file)
@@ -84,8 +84,7 @@ int cxgb4_get_srq_entry(struct net_device *dev,
        if (!skb)
                return -ENOMEM;
        req = (struct cpl_srq_table_req *)
-               __skb_put(skb, sizeof(*req));
-       memset(req, 0, sizeof(*req));
+               __skb_put_zero(skb, sizeof(*req));
        INIT_TP_WR(req, 0);
        OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SRQ_TABLE_REQ,
                                              TID_TID_V(srq_idx) |
index 4b5aacc09cab7a7882aea252a3dad886b3b6abf3..240ba9d4c39991b36345ff7f9e548720e8ba2e58 100644 (file)
@@ -90,8 +90,7 @@ cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan)
 {
        struct cpl_tid_release *req;
 
-       req = __skb_put(skb, len);
-       memset(req, 0, len);
+       req = __skb_put_zero(skb, len);
 
        INIT_TP_WR(req, tid);
        OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, tid));
@@ -104,8 +103,7 @@ cxgb_mk_close_con_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan,
 {
        struct cpl_close_con_req *req;
 
-       req = __skb_put(skb, len);
-       memset(req, 0, len);
+       req = __skb_put_zero(skb, len);
 
        INIT_TP_WR(req, tid);
        OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid));
@@ -119,8 +117,7 @@ cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan,
 {
        struct cpl_abort_req *req;
 
-       req = __skb_put(skb, len);
-       memset(req, 0, len);
+       req = __skb_put_zero(skb, len);
 
        INIT_TP_WR(req, tid);
        OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_REQ, tid));
@@ -134,8 +131,7 @@ cxgb_mk_abort_rpl(struct sk_buff *skb, u32 len, u32 tid, u16 chan)
 {
        struct cpl_abort_rpl *rpl;
 
-       rpl = __skb_put(skb, len);
-       memset(rpl, 0, len);
+       rpl = __skb_put_zero(skb, len);
 
        INIT_TP_WR(rpl, tid);
        OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid));
@@ -149,8 +145,7 @@ cxgb_mk_rx_data_ack(struct sk_buff *skb, u32 len, u32 tid, u16 chan,
 {
        struct cpl_rx_data_ack *req;
 
-       req = __skb_put(skb, len);
-       memset(req, 0, len);
+       req = __skb_put_zero(skb, len);
 
        INIT_TP_WR(req, tid);
        OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK, tid));