From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0071.outbound.protection.outlook.com [104.47.42.71]) by dpdk.org (Postfix) with ESMTP id E207CD149 for ; Fri, 24 Mar 2017 14:36:16 +0100 (CET) Received: from BN6PR03CA0024.namprd03.prod.outlook.com (10.168.230.162) by BN6PR03MB2785.namprd03.prod.outlook.com (10.173.144.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 24 Mar 2017 13:36:15 +0000 Received: from BN1BFFO11FD037.protection.gbl (2a01:111:f400:7c10::1:104) by BN6PR03CA0024.outlook.office365.com (2603:10b6:404:23::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 13:36:15 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD037.mail.protection.outlook.com (10.58.144.100) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 13:36:15 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2ODZhfu005481; Fri, 24 Mar 2017 06:36:12 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 24 Mar 2017 19:05:25 +0530 Message-ID: <1490362538-20854-10-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> References: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131348361752108951; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39840400002)(39450400003)(39860400002)(39410400002)(39400400002)(39850400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(53936002)(4326008)(189998001)(5003940100001)(85426001)(76176999)(50986999)(48376002)(356003)(8656002)(50466002)(104016004)(77096006)(38730400002)(110136004)(305945005)(54906002)(36756003)(105606002)(50226002)(86362001)(575784001)(2906002)(47776003)(5660300001)(8936002)(2351001)(8676002)(33646002)(81166006)(2950100002)(6666003)(6916009)(106466001)(5890100001)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2785; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD037; 1:RxYuKo/o9RUwV+YMoz6QuJ1Ou7t0ng1kwfi3zYLHPPlALbibnx/gc82rcqkEu8OqGI4PaRDWrTosfHwMGMpa29/xVPHNxiAerha0nuc6dBfKkhkZJoemx04bYkJBffkgCL/LYf3RgH5siHOL4y4kI2iv/IFb5Chc7XpRRoVJSVxRAHfjPVD2ULo1d4aSG6QU9hti+D3vBNTnLTt7vIYj6b54rc9qJhGhnG67/TM/o3VylPN2zex3cTKLX1sk4vpk2zteeMG1r0nfib2RO/z6uT+jMt17PpEf7uevvL4XPNA0gmQCGAidRqlnm3DwgE/rQkYz26hGbCwfhqP13X7ZKbWVQ9Ghm6GA4Ad0o7/39HKBKNJS/NjeS5+G4zQ6WW3HzKNMtVz8ZfnUKkDGfqNV9CPJ/rhVH8u5S6cBzUJHcewJxrb3hYQRbxj2NY6jNva8wopaQd++8ETiLSbcwyFDfVkae0aOt+2xYgtAxhTZ3ruQ6N3nmXVuYcoSj1eyZSZxjLaovDyOmFrePwvugKO3GR+nfrlXsmxeTYiyjSLKuIArFGlMnLbcJMeB+KX1GZlqMww5tcw9f4OtD5DqwlFDBbCysW+7NuNzwHQ+RggqT7J6YK0mQzmKmahLi+KDBcoZWvHHhMoOzCWPc+sKC5o3rw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8ca4dee7-3743-442d-fe36-08d472babe84 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2785; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 3:AOhpF0aLCr8cjspHGfvfpm/HdLYGuCEG/DlMezuIe3b+aETgrW6kfIy6P09ophfKkt0iZTXDmeNMgJFeFw70NR37uYhDpsQTXR50x3haZSA7sHRll9qG5SGVPFIJnbbJ5Jl8PpLw0JvFXjik7JWaiV45jLNtXlnMeu4B5C99mJ+bCPFai6k1GTDYKpnhZzyZZNWHH5b5E7bjkXr70hUIg+B/dGKTh48OAt0QISH+GJVP/wCXAXpu/EaBrhjQ9ZjWLm78qWxQirY+KnNixn5cOecCHFJOVhCnlET+6PykF+QKIkmWdiAjlRiIeCV3wTSLcHX+K7PWfQSaRwg7e7FFJzmgMnxKxn4st5/s07J/KObCo7Pe1Vbab3KD05+i3oio; 25:gW6YodX34Nj1E6NAAj+/F6qFQGbsbiLBPfMtbFS8XglLfF0NP83xrcmpmtjb8Kv0cgdaFZIZ7LMEXSoW4CD13X2+MA3/t6VvaCX9foWTrEcW2bDHUXscWtfoXxN89RbpCi+k/MQUb4V8DOH6zQPipf4gfwGvC2fcglWFK9d57QPO11VjQYY30+1StW6aHOneY74/zSDNFRYaO7dAn5F7CcuSK80gdwb2HpgGRBd+Amt082rEugOl4hO6o0fWEyf9X67rHD8vXrCOHKSXE2HpNxt3i/ATsBEEJlU9X8WMves+oKMdZwW8DuxWG/4SH6hxPg8oVGa2tZeBUSOECdDdI6Uv0IEygKhQ7ngpb87fsGFWZ0QevdQXD/vYjmYY845FYJv4oB3gt3jgTks1kz8n/13aryHlYF9T4Jj5xphBd19bTvoskJ3qlwno2Hj/mwS9pbmABDkmqXHfW3/1t750Mg== X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 31:EB21QIWSYV2UjN3zRMTQvCu6rTrV/VyQ5B4I+a6KtYZ1m/1gmzJt9QJ55AmHsZhu+9s0H277p75W31GZFMH90+DIB3ZYx/6xs3SQDzadZ9v08yyf9THNqZ5I9tkCkOxapsvAvv/xzurnvLtXyVqDIJIG2+nA0XU2t8VfeRw8s2cwS+Sdas/gioKV4r1/VSMHE8ectAZBBeN7DLqfA6LblftQVRVxs0aH2Mo5OlgVHMAnXTlPKNccQRDJ85rx7lIfrOj/vuFXRgTFRW83A41l8sKIL1RJvQw/ECqulJ3vikY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(13017025)(13015025)(8121501046)(13024025)(13023025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123561025)(20161123563025)(20161123559025)(20161123565025); SRVR:BN6PR03MB2785; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2785; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 4:g52bR0B2k+KQcDc7Kp/POuzAVW5UOf7KWolxTUp+RemxlV09uQIe2d+IfUrOXMPkl5D5MlE58eav9bW+KcERlK+rkWDWxFjXaGnoVlCTfHW1z0FH/cX9mOlcEV5tP922e3oNIetMCrTSuW9mgdyircu0ItAcX3m/nbDdUGZnYerr6R4AAYLx5/64GdD0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Tqv4y/j?= =?us-ascii?Q?khr5zG9mYG/SwQSDJfp9gZSxeba/CxWttVTYssXxYy+ZmoIYJ8md/y2tNnTB?= =?us-ascii?Q?KAuyP2wHt19wCz7iHeTl4rIVoi4OK3d9zEPWep3vUSr2oenJOxA2vX3PI1q6?= =?us-ascii?Q?UB8LSi1NMiFtTp6A5CfLzo0DRm/yE82fr2ITDug8mECcajdirV/0WEn+AHPg?= =?us-ascii?Q?lCk57mPGfBK7R8RfdgeJHuhk20vA9gKvxaQHMafP+Cd6CMV4fcD+qktm0wt7?= =?us-ascii?Q?uuWYxxsmguEInWqsbztPaPi08ERAtzgDgp0O6lweIN4UqByBQacaaQpHkV0H?= =?us-ascii?Q?daRv6WMPIzsMn/YvNUf0eptCX3Tsi6DI5uGCdZr7NIQEemqpPnYA2R5fsquv?= =?us-ascii?Q?QDsiLwEJHlwYthdOH40JZEQyUW1LHHzpmrbltf4G8UTcLuuOXGdqFbEkGaCD?= =?us-ascii?Q?l6PsFa0zedPbHYSVzHLphc7trjZUDVl9d38dQXUGY7/2OXfCc20tIsvh2F1z?= =?us-ascii?Q?fJ/YH2swZzbw/BnHW6SUQut/QvGWIINQJlMpyX6JeroWqnOdMbyWodUFIdKN?= =?us-ascii?Q?oNr+2zLnOzsyo+bpFKbRB0YZe61w2DUkxUUrRBJd27Ni51iGqFpVpYMf3zPF?= =?us-ascii?Q?i5uS6TTx73HzXNXtJq/mAtq/+vUgFNd8W4XNwWQvufkRs+swFg0M4CAJLDYg?= =?us-ascii?Q?OFjcMXaB/YhXx0EqyHyomWyM3kjfFz4A/5/Meh15+602G+vIFRUGdRTsRORo?= =?us-ascii?Q?iExlwzGecOZggiWQYJJPE8/YocDXlaK8vwKVP+wpEJjAg4n7JCeKt6UQovut?= =?us-ascii?Q?lZjgxPudsXBcEBsy6+raMuuv5e2FdwlEsz11qhOuQfakZoQhOpqL78TLEe6W?= =?us-ascii?Q?DaElh+kkEMmqjWWB+fJcT7XkugDsoqGPh0OMfdwjO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9kH/z8I8Ox/knL8WmL/HmC2OepMzT7W6qa/Kh3YJQkzaOrVvUm1CIaJZcMRq90b1tLIUIO8ostzKI/nHTkT/uo/narJYmydUm9y2Tgkxp8nOZmIPFHILWdk6qCLV8ZRpZy9vB/XUA4S7nFdBCRoN5Q6SQFngRHLC4EeEu/jjsCb6NXC+Uo8FEIWeuEC26ufvo1wi7tduKgNzPtcNwxNRIWlUW7fntTINoBNNKrmQ2Xdb08WCX6Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 13:36:15.0236 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2785 Subject: [dpdk-dev] [PATCH v10 09/22] net/dpaa2: attach the buffer pool to dpni X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 13:36:17 -0000 This patch configures a MC-DPNI based DPAA2 PMD network port with a DPBP based buffer pool. Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/Makefile | 4 +++ drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 57 +++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.c | 62 ++++++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 6 ++++ 4 files changed, 129 insertions(+) diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index c2ef774..5b3a020 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -50,6 +50,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal +CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -64,8 +65,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c # library dependencies DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_eal lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += drivers/bus/fslmc +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += drivers/mempool/dpaa2 LDLIBS += -lrte_bus_fslmc +LDLIBS += -lrte_mempool_dpaa2 include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index c95c083..08f53b3 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -46,6 +46,7 @@ #include #include +#include #include "../dpaa2_ethdev.h" @@ -285,3 +286,59 @@ int dpaa2_remove_flow_dist( } kg_cfg->num_extracts = i; } + +int +dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, + void *blist) +{ + /* Function to attach a DPNI with a buffer pool list. Buffer pool list + * handle is passed in blist. + */ + int32_t retcode; + struct fsl_mc_io *dpni = priv->hw; + struct dpni_pools_cfg bpool_cfg; + struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist; + struct dpni_buffer_layout layout; + int tot_size; + + /* ... rx buffer layout . + * Check alignment for buffer layouts first + */ + + /* ... rx buffer layout ... */ + tot_size = DPAA2_HW_BUF_RESERVE + RTE_PKTMBUF_HEADROOM; + tot_size = RTE_ALIGN_CEIL(tot_size, + DPAA2_PACKET_LAYOUT_ALIGN); + + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM; + + layout.data_head_room = + tot_size - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; + retcode = dpni_set_buffer_layout(dpni, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_RX, &layout); + if (retcode) { + PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout\n", + retcode); + return retcode; + } + + /*Attach buffer pool to the network interface as described by the user*/ + bpool_cfg.num_dpbp = 1; + bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id; + bpool_cfg.pools[0].backup_pool = 0; + bpool_cfg.pools[0].buffer_size = + RTE_ALIGN_CEIL(bp_list->buf_pool.size, + 256 /*DPAA2_PACKET_LAYOUT_ALIGN*/); + + retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg); + if (retcode != 0) { + PMD_INIT_LOG(ERR, "Error in attaching the buffer pool list" + " bpid = %d Error code = %d\n", + bpool_cfg.pools[0].dpbp_id, retcode); + return retcode; + } + + priv->bp_list = bp_list; + return 0; +} diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 6462e0b..e1bdeef 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "dpaa2_ethdev.h" @@ -63,6 +64,8 @@ dev_info->if_index = priv->hw_id; dev_info->max_mac_addrs = priv->max_mac_filters; + dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN; + dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE; dev_info->max_rx_queues = (uint16_t)priv->nb_rx_queues; dev_info->max_tx_queues = (uint16_t)priv->nb_tx_queues; @@ -187,6 +190,7 @@ struct dpni_queue cfg; uint8_t options = 0; uint8_t flow_id; + uint32_t bpid; int ret; PMD_INIT_FUNC_TRACE(); @@ -194,6 +198,13 @@ PMD_INIT_LOG(DEBUG, "dev =%p, queue =%d, pool = %p, conf =%p", dev, rx_queue_id, mb_pool, rx_conf); + if (!priv->bp_list || priv->bp_list->mp != mb_pool) { + bpid = mempool_to_bpid(mb_pool); + ret = dpaa2_attach_bp_list(priv, + rte_dpaa2_bpid_info[bpid].bp_list); + if (ret) + return ret; + } dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id]; dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */ @@ -388,7 +399,9 @@ struct fsl_mc_io *dpni_dev; struct dpni_attr attr; struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; + struct dpni_buffer_layout layout; int i, ret, hw_id; + int tot_size; PMD_INIT_FUNC_TRACE(); @@ -475,6 +488,55 @@ return -ret; } + /* ... rx buffer layout ... */ + tot_size = DPAA2_HW_BUF_RESERVE + RTE_PKTMBUF_HEADROOM; + tot_size = RTE_ALIGN_CEIL(tot_size, + DPAA2_PACKET_LAYOUT_ALIGN); + + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | + DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | + DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM | + DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; + + layout.pass_frame_status = 1; + layout.data_head_room = tot_size + - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; + layout.private_data_size = DPAA2_FD_PTA_SIZE; + layout.pass_parser_result = 1; + PMD_INIT_LOG(DEBUG, "Tot_size = %d, head room = %d, private = %d", + tot_size, layout.data_head_room, layout.private_data_size); + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_RX, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout", ret); + return -1; + } + + /* ... tx buffer layout ... */ + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; + layout.pass_frame_status = 1; + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_TX, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Error (%d) in setting tx buffer" + " layout", ret); + return -1; + } + + /* ... tx-conf and error buffer layout ... */ + memset(&layout, 0, sizeof(struct dpni_buffer_layout)); + layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; + layout.pass_frame_status = 1; + ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_TX_CONFIRM, &layout); + if (ret) { + PMD_INIT_LOG(ERR, "Error (%d) in setting tx-conf buffer" + " layout", ret); + return -1; + } + eth_dev->dev_ops = &dpaa2_ethdev_ops; eth_dev->data->drv_name = rte_dpaa2_pmd.driver.name; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 2d13137..a56b525 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -37,6 +37,9 @@ #include #include +#define DPAA2_MIN_RX_BUF_SIZE 512 +#define DPAA2_MAX_RX_PKT_LEN 10240 /*WRIOP support*/ + #define MAX_TCS DPNI_MAX_TC #define MAX_RX_QUEUES 16 #define MAX_TX_QUEUES 16 @@ -57,6 +60,7 @@ struct dpaa2_dev_priv { void *rx_vq[MAX_RX_QUEUES]; void *tx_vq[MAX_TX_QUEUES]; + struct dpaa2_bp_list *bp_list; /**