You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2017/03/06 21:19:00 UTC

[24/50] incubator-mynewt-core git commit: nimble/l2cap: Make ble_l2cap_chan available in ble_l2cap_rx_fn

nimble/l2cap: Make ble_l2cap_chan available in ble_l2cap_rx_fn

Each L2CAP channel has its data handler function. Till now we had
function per CID. In order to handle COC we need to have possibility
to handle more channels in same data handler function. For this reason
we need to have pointer to ble_l2cap_chan to which data are comming.

This patch does it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/27bc9edf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/27bc9edf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/27bc9edf

Branch: refs/heads/master
Commit: 27bc9edf37d344ba67110ee80af148b1861392c6
Parents: d9f788b
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Thu Feb 2 14:44:47 2017 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Fri Mar 3 12:40:42 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/include/host/ble_l2cap.h    |  1 +
 net/nimble/host/src/ble_att.c               | 12 +++++++++---
 net/nimble/host/src/ble_att_priv.h          |  2 +-
 net/nimble/host/src/ble_gap.c               |  3 +--
 net/nimble/host/src/ble_hs_conn.c           |  9 +++++----
 net/nimble/host/src/ble_hs_conn_priv.h      |  2 +-
 net/nimble/host/src/ble_hs_hci_evt.c        |  3 ++-
 net/nimble/host/src/ble_l2cap.c             | 16 +++++++++++++---
 net/nimble/host/src/ble_l2cap_coc.c         |  5 ++---
 net/nimble/host/src/ble_l2cap_priv.h        |  7 ++++---
 net/nimble/host/src/ble_l2cap_sig.c         |  7 ++++---
 net/nimble/host/src/ble_l2cap_sig_priv.h    |  2 +-
 net/nimble/host/src/ble_sm.c                | 20 ++++++++++++++++----
 net/nimble/host/src/ble_sm_priv.h           |  2 +-
 net/nimble/host/test/src/ble_hs_test_util.c |  3 ++-
 net/nimble/host/test/src/ble_l2cap_test.c   |  4 ++--
 16 files changed, 65 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/include/host/ble_l2cap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_l2cap.h b/net/nimble/host/include/host/ble_l2cap.h
index 604d080..b3b03b9 100644
--- a/net/nimble/host/include/host/ble_l2cap.h
+++ b/net/nimble/host/include/host/ble_l2cap.h
@@ -174,6 +174,7 @@ struct ble_l2cap_event {
 
 typedef int ble_l2cap_event_fn(struct ble_l2cap_event *event, void *arg);
 
+uint16_t ble_l2cap_get_conn_handle(struct ble_l2cap_chan *chan);
 int ble_l2cap_create_server(uint16_t psm, uint16_t mtu,
                             ble_l2cap_event_fn *cb, void *cb_arg);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_att.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att.c b/net/nimble/host/src/ble_att.c
index 329fcec..7876e0d 100644
--- a/net/nimble/host/src/ble_att.c
+++ b/net/nimble/host/src/ble_att.c
@@ -461,12 +461,18 @@ ble_att_chan_mtu(const struct ble_l2cap_chan *chan)
 }
 
 static int
-ble_att_rx(uint16_t conn_handle, struct os_mbuf **om)
+ble_att_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
 {
     const struct ble_att_rx_dispatch_entry *entry;
     uint8_t op;
+    uint16_t conn_handle;
     int rc;
 
+    conn_handle = ble_l2cap_get_conn_handle(chan);
+    if (!conn_handle) {
+        return BLE_HS_ENOTCONN;
+    }
+
     rc = os_mbuf_copydata(*om, 0, 1, &op);
     if (rc != 0) {
         return BLE_HS_EMSGSIZE;
@@ -551,11 +557,11 @@ ble_att_set_preferred_mtu(uint16_t mtu)
 }
 
 struct ble_l2cap_chan *
-ble_att_create_chan(void)
+ble_att_create_chan(uint16_t conn_handle)
 {
     struct ble_l2cap_chan *chan;
 
-    chan = ble_l2cap_chan_alloc();
+    chan = ble_l2cap_chan_alloc(conn_handle);
     if (chan == NULL) {
         return NULL;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_att_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_priv.h b/net/nimble/host/src/ble_att_priv.h
index 22ed62e..af05684 100644
--- a/net/nimble/host/src/ble_att_priv.h
+++ b/net/nimble/host/src/ble_att_priv.h
@@ -159,7 +159,7 @@ SLIST_HEAD(ble_att_clt_entry_list, ble_att_clt_entry);
 
 /*** @gen */
 
-struct ble_l2cap_chan *ble_att_create_chan(void);
+struct ble_l2cap_chan *ble_att_create_chan(uint16_t conn_handle);
 void ble_att_conn_chan_find(uint16_t conn_handle, struct ble_hs_conn **out_conn,
                             struct ble_l2cap_chan **out_chan);
 void ble_att_inc_tx_stat(uint8_t att_op);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index 92c3d12..0a09d4c 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -1151,10 +1151,9 @@ ble_gap_rx_conn_complete(struct hci_le_conn_complete *evt)
     }
 
     /* We verified that there is a free connection when the procedure began. */
-    conn = ble_hs_conn_alloc();
+    conn = ble_hs_conn_alloc(evt->connection_handle);
     BLE_HS_DBG_ASSERT(conn != NULL);
 
-    conn->bhc_handle = evt->connection_handle;
     conn->bhc_itvl = evt->conn_itvl;
     conn->bhc_latency = evt->conn_latency;
     conn->bhc_supervision_timeout = evt->supervision_timeout;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_hs_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.c b/net/nimble/host/src/ble_hs_conn.c
index 02676fa..a371ace 100644
--- a/net/nimble/host/src/ble_hs_conn.c
+++ b/net/nimble/host/src/ble_hs_conn.c
@@ -102,7 +102,7 @@ ble_hs_conn_chan_insert(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
 }
 
 struct ble_hs_conn *
-ble_hs_conn_alloc(void)
+ble_hs_conn_alloc(uint16_t conn_handle)
 {
 #if !NIMBLE_BLE_CONNECT
     return NULL;
@@ -117,10 +117,11 @@ ble_hs_conn_alloc(void)
         goto err;
     }
     memset(conn, 0, sizeof *conn);
+    conn->bhc_handle = conn_handle;
 
     SLIST_INIT(&conn->bhc_channels);
 
-    chan = ble_att_create_chan();
+    chan = ble_att_create_chan(conn_handle);
     if (chan == NULL) {
         goto err;
     }
@@ -129,7 +130,7 @@ ble_hs_conn_alloc(void)
         goto err;
     }
 
-    chan = ble_l2cap_sig_create_chan();
+    chan = ble_l2cap_sig_create_chan(conn_handle);
     if (chan == NULL) {
         goto err;
     }
@@ -141,7 +142,7 @@ ble_hs_conn_alloc(void)
     /* Create the SM channel even if not configured. We need it to reject SM
      * messages.
      */
-    chan = ble_sm_create_chan();
+    chan = ble_sm_create_chan(conn_handle);
     if (chan == NULL) {
         goto err;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_hs_conn_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn_priv.h b/net/nimble/host/src/ble_hs_conn_priv.h
index b58a0df..24e2e48 100644
--- a/net/nimble/host/src/ble_hs_conn_priv.h
+++ b/net/nimble/host/src/ble_hs_conn_priv.h
@@ -74,7 +74,7 @@ struct ble_hs_conn_addrs {
 };
 
 int ble_hs_conn_can_alloc(void);
-struct ble_hs_conn *ble_hs_conn_alloc(void);
+struct ble_hs_conn *ble_hs_conn_alloc(uint16_t conn_handle);
 void ble_hs_conn_free(struct ble_hs_conn *conn);
 void ble_hs_conn_insert(struct ble_hs_conn *conn);
 void ble_hs_conn_remove(struct ble_hs_conn *conn);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_hs_hci_evt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_hci_evt.c b/net/nimble/host/src/ble_hs_hci_evt.c
index a2d7a52..7f868a6 100644
--- a/net/nimble/host/src/ble_hs_hci_evt.c
+++ b/net/nimble/host/src/ble_hs_hci_evt.c
@@ -659,7 +659,8 @@ ble_hs_hci_evt_acl_process(struct os_mbuf *om)
         /* Final fragment received. */
         BLE_HS_DBG_ASSERT(rx_cb != NULL);
         BLE_HS_DBG_ASSERT(rx_buf != NULL);
-        rc = rx_cb(conn_handle, &rx_buf);
+        rc = rx_cb(conn->bhc_rx_chan, &rx_buf);
+        ble_l2cap_forget_rx(conn, conn->bhc_rx_chan);
         os_mbuf_free_chain(rx_buf);
         break;
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index 09ca9dc..d909b78 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -52,7 +52,7 @@ STATS_NAME_START(ble_l2cap_stats)
 STATS_NAME_END(ble_l2cap_stats)
 
 struct ble_l2cap_chan *
-ble_l2cap_chan_alloc(void)
+ble_l2cap_chan_alloc(uint16_t conn_handle)
 {
     struct ble_l2cap_chan *chan;
 
@@ -62,6 +62,7 @@ ble_l2cap_chan_alloc(void)
     }
 
     memset(chan, 0, sizeof *chan);
+    chan->conn_handle = conn_handle;
 
     STATS_INC(ble_l2cap_stats, chan_create);
 
@@ -126,6 +127,16 @@ ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid, uint16_t len)
     return om;
 }
 
+uint16_t
+ble_l2cap_get_conn_handle(struct ble_l2cap_chan *chan)
+{
+    if (!chan) {
+        return 0;
+    }
+
+    return chan->conn_handle;
+}
+
 int
 ble_l2cap_create_server(uint16_t psm, uint16_t mtu,
                         ble_l2cap_event_fn *cb, void *cb_arg)
@@ -158,7 +169,7 @@ ble_l2cap_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
     /*TODO In here we going to update sdu_rx buffer */
 }
 
-static void
+void
 ble_l2cap_forget_rx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
 {
     conn->bhc_rx_chan = NULL;
@@ -221,7 +232,6 @@ ble_l2cap_rx_payload(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
         /* All fragments received. */
         *out_rx_cb = chan->rx_fn;
         *out_rx_buf = chan->rx_buf;
-        ble_l2cap_forget_rx(conn, chan);
         rc = 0;
     } else {
         /* More fragments remain. */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_l2cap_coc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_coc.c b/net/nimble/host/src/ble_l2cap_coc.c
index 46b903b..178370d 100644
--- a/net/nimble/host/src/ble_l2cap_coc.c
+++ b/net/nimble/host/src/ble_l2cap_coc.c
@@ -117,7 +117,7 @@ ble_l2cap_coc_srv_find(uint16_t psm)
 }
 
 static int
-ble_l2cap_coc_rx_fn(uint16_t conn_handle, struct os_mbuf **rxom)
+ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **rxom)
 {
     return 0;
 }
@@ -129,12 +129,11 @@ ble_l2cap_coc_chan_alloc(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
 {
     struct ble_l2cap_chan *chan;
 
-    chan = ble_l2cap_chan_alloc();
+    chan = ble_l2cap_chan_alloc(conn_handle);
     if (!chan) {
         return NULL;
     }
 
-    chan->conn_handle = conn_handle;
     chan->psm = psm;
     chan->cb = cb;
     chan->cb_arg = cb_arg;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_l2cap_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_priv.h b/net/nimble/host/src/ble_l2cap_priv.h
index 81e350d..64ffa22 100644
--- a/net/nimble/host/src/ble_l2cap_priv.h
+++ b/net/nimble/host/src/ble_l2cap_priv.h
@@ -62,10 +62,11 @@ extern struct os_mempool ble_l2cap_chan_pool;
 
 typedef uint8_t ble_l2cap_chan_flags;
 
-typedef int ble_l2cap_rx_fn(uint16_t conn_handle, struct os_mbuf **rxom);
+typedef int ble_l2cap_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **rxom);
 
 struct ble_l2cap_chan {
     SLIST_ENTRY(ble_l2cap_chan) next;
+    uint16_t conn_handle;
     uint16_t dcid;
     uint16_t scid;
     uint16_t my_mtu;
@@ -78,7 +79,6 @@ struct ble_l2cap_chan {
     ble_l2cap_rx_fn *rx_fn;
 
 #if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) != 0
-    uint16_t conn_handle;
     uint16_t psm;
     struct ble_l2cap_coc_endpoint coc_rx;
     struct ble_l2cap_coc_endpoint coc_tx;
@@ -104,7 +104,7 @@ int ble_l2cap_parse_hdr(struct os_mbuf *om, int off,
 struct os_mbuf *ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid,
                                       uint16_t len);
 
-struct ble_l2cap_chan *ble_l2cap_chan_alloc(void);
+struct ble_l2cap_chan *ble_l2cap_chan_alloc(uint16_t conn_handle);
 void ble_l2cap_chan_free(struct ble_l2cap_chan *chan);
 
 bool ble_l2cap_is_mtu_req_sent(const struct ble_l2cap_chan *chan);
@@ -118,6 +118,7 @@ int ble_l2cap_rx(struct ble_hs_conn *conn,
 int ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
                  struct os_mbuf *txom);
 
+void ble_l2cap_forget_rx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan);
 int ble_l2cap_init(void);
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 560311d..93d73ed 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -1012,10 +1012,11 @@ ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan)
  *****************************************************************************/
 
 static int
-ble_l2cap_sig_rx(uint16_t conn_handle, struct os_mbuf **om)
+ble_l2cap_sig_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
 {
     struct ble_l2cap_sig_hdr hdr;
     ble_l2cap_sig_rx_fn *rx_cb;
+    uint16_t conn_handle = chan->conn_handle;
     int rc;
 
     STATS_INC(ble_l2cap_stats, sig_rx);
@@ -1054,11 +1055,11 @@ ble_l2cap_sig_rx(uint16_t conn_handle, struct os_mbuf **om)
 }
 
 struct ble_l2cap_chan *
-ble_l2cap_sig_create_chan(void)
+ble_l2cap_sig_create_chan(uint16_t conn_handle)
 {
     struct ble_l2cap_chan *chan;
 
-    chan = ble_l2cap_chan_alloc();
+    chan = ble_l2cap_chan_alloc(conn_handle);
     if (chan == NULL) {
         return NULL;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_l2cap_sig_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig_priv.h b/net/nimble/host/src/ble_l2cap_sig_priv.h
index ad3b846..0677405 100644
--- a/net/nimble/host/src/ble_l2cap_sig_priv.h
+++ b/net/nimble/host/src/ble_l2cap_sig_priv.h
@@ -111,7 +111,7 @@ int ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan);
 
 void ble_l2cap_sig_conn_broken(uint16_t conn_handle, int reason);
 int32_t ble_l2cap_sig_timer(void);
-struct ble_l2cap_chan *ble_l2cap_sig_create_chan(void);
+struct ble_l2cap_chan *ble_l2cap_sig_create_chan(uint16_t conn_handle);
 int ble_l2cap_sig_init(void);
 
 #ifdef __cplusplus

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c
index 2a880dc..603d99c 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -2326,15 +2326,21 @@ ble_sm_unbond(uint8_t peer_id_addr_type, const uint8_t *peer_id_addr)
 }
 
 static int
-ble_sm_rx(uint16_t conn_handle, struct os_mbuf **om)
+ble_sm_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
 {
     struct ble_sm_result res;
     ble_sm_rx_fn *rx_cb;
     uint8_t op;
+    uint16_t conn_handle;
     int rc;
 
     STATS_INC(ble_l2cap_stats, sm_rx);
 
+    conn_handle = ble_l2cap_get_conn_handle(chan);
+    if (!conn_handle) {
+        return BLE_HS_ENOTCONN;
+    }
+
     rc = os_mbuf_copydata(*om, 0, 1, &op);
     if (rc != 0) {
         return BLE_HS_EBADDATA;
@@ -2485,10 +2491,16 @@ ble_sm_init(void)
  * simple
  */
 static int
-ble_sm_rx(uint16_t handle, struct os_mbuf **om)
+ble_sm_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
 {
     struct ble_sm_pair_fail *cmd;
     struct os_mbuf *txom;
+    uint16_t handle;
+
+    handle = ble_l2cap_get_conn_handle(chan);
+    if (!handle) {
+        return BLE_HS_ENOTCONN;
+    }
 
     cmd = ble_sm_cmd_get(BLE_SM_OP_PAIR_FAIL, sizeof(*cmd), &txom);
     if (cmd == NULL) {
@@ -2502,11 +2514,11 @@ ble_sm_rx(uint16_t handle, struct os_mbuf **om)
 #endif
 
 struct ble_l2cap_chan *
-ble_sm_create_chan(void)
+ble_sm_create_chan(uint16_t conn_handle)
 {
     struct ble_l2cap_chan *chan;
 
-    chan = ble_l2cap_chan_alloc();
+    chan = ble_l2cap_chan_alloc(conn_handle);
     if (chan == NULL) {
         return NULL;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/src/ble_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_priv.h b/net/nimble/host/src/ble_sm_priv.h
index eb4f2da..86c31da 100644
--- a/net/nimble/host/src/ble_sm_priv.h
+++ b/net/nimble/host/src/ble_sm_priv.h
@@ -419,7 +419,7 @@ int ble_sm_init(void);
 
 #endif
 
-struct ble_l2cap_chan *ble_sm_create_chan(void);
+struct ble_l2cap_chan *ble_sm_create_chan(uint16_t handle);
 void *ble_sm_cmd_get(uint8_t opcode, size_t len, struct os_mbuf **txom);
 int ble_sm_tx(uint16_t conn_handle, struct os_mbuf *txom);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/test/src/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_test_util.c b/net/nimble/host/test/src/ble_hs_test_util.c
index 0dc1b18..9fa2d3d 100644
--- a/net/nimble/host/test/src/ble_hs_test_util.c
+++ b/net/nimble/host/test/src/ble_hs_test_util.c
@@ -954,7 +954,8 @@ ble_hs_test_util_l2cap_rx(uint16_t conn_handle,
     } else if (rc == 0) {
         TEST_ASSERT_FATAL(rx_cb != NULL);
         TEST_ASSERT_FATAL(rx_buf != NULL);
-        rc = rx_cb(conn_handle, &rx_buf);
+        rc = rx_cb(conn->bhc_rx_chan, &rx_buf);
+        ble_l2cap_forget_rx(conn, conn->bhc_rx_chan);
         os_mbuf_free_chain(rx_buf);
     } else if (rc == BLE_HS_EAGAIN) {
         /* More fragments on the way. */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27bc9edf/net/nimble/host/test/src/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_l2cap_test.c b/net/nimble/host/test/src/ble_l2cap_test.c
index 9c11607..e68971d 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -94,7 +94,7 @@ ble_l2cap_test_util_verify_tx_update_conn(
 }
 
 static int
-ble_l2cap_test_util_dummy_rx(uint16_t conn_handle, struct os_mbuf **om)
+ble_l2cap_test_util_dummy_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
 {
     return 0;
 }
@@ -113,7 +113,7 @@ ble_l2cap_test_util_create_conn(uint16_t conn_handle, uint8_t *addr,
     conn = ble_hs_conn_find(conn_handle);
     TEST_ASSERT_FATAL(conn != NULL);
 
-    chan = ble_l2cap_chan_alloc();
+    chan = ble_l2cap_chan_alloc(conn_handle);
     TEST_ASSERT_FATAL(chan != NULL);
 
     chan->scid = BLE_L2CAP_TEST_CID;