* Flush hardware bpool (buffer-pool). * * @param dev * Pointer to Ethernet device structure. */
| 1038 | * Pointer to Ethernet device structure. |
| 1039 | */ |
| 1040 | static void |
| 1041 | mrvl_flush_bpool(struct rte_eth_dev *dev) |
| 1042 | { |
| 1043 | struct mrvl_priv *priv = dev->data->dev_private; |
| 1044 | struct pp2_hif *hif; |
| 1045 | uint32_t num; |
| 1046 | int ret; |
| 1047 | unsigned int core_id = rte_lcore_id(); |
| 1048 | |
| 1049 | if (core_id == LCORE_ID_ANY) |
| 1050 | core_id = rte_get_main_lcore(); |
| 1051 | |
| 1052 | hif = mrvl_get_hif(priv, core_id); |
| 1053 | |
| 1054 | ret = pp2_bpool_get_num_buffs(priv->bpool, &num); |
| 1055 | if (ret) { |
| 1056 | MRVL_LOG(ERR, "Failed to get bpool buffers number"); |
| 1057 | return; |
| 1058 | } |
| 1059 | |
| 1060 | while (num--) { |
| 1061 | struct pp2_buff_inf inf; |
| 1062 | uint64_t addr; |
| 1063 | |
| 1064 | ret = pp2_bpool_get_buff(hif, priv->bpool, &inf); |
| 1065 | if (ret) |
| 1066 | break; |
| 1067 | |
| 1068 | addr = cookie_addr_high | inf.cookie; |
| 1069 | rte_pktmbuf_free((struct rte_mbuf *)addr); |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | /** |
| 1074 | * DPDK callback to stop the device. |
no test coverage detected