struct hns3_mp_param *res = (struct hns3_mp_param *)mp_res.param;
const struct hns3_mp_param *param =
(const struct hns3_mp_param *)mp_msg->param;
+ eth_tx_prep_t prep = NULL;
struct rte_eth_dev *dev;
int ret;
PMD_INIT_LOG(INFO, "port %u starting datapath",
dev->data->port_id);
hns3_set_rxtx_function(dev);
- rte_mb();
- mp_init_msg(dev, &mp_res, param->type);
- res->result = 0;
- ret = rte_mp_reply(&mp_res, peer);
break;
case HNS3_MP_REQ_STOP_RXTX:
PMD_INIT_LOG(INFO, "port %u stopping datapath",
dev->data->port_id);
hns3_set_rxtx_function(dev);
- rte_mb();
- mp_init_msg(dev, &mp_res, param->type);
- res->result = 0;
- ret = rte_mp_reply(&mp_res, peer);
+ break;
+ case HNS3_MP_REQ_START_TX:
+ PMD_INIT_LOG(INFO, "port %u starting Tx datapath",
+ dev->data->port_id);
+ dev->tx_pkt_burst = hns3_get_tx_function(dev, &prep);
+ dev->tx_pkt_prepare = prep;
+ break;
+ case HNS3_MP_REQ_STOP_TX:
+ PMD_INIT_LOG(INFO, "port %u stopping Tx datapath",
+ dev->data->port_id);
+ dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
+ dev->tx_pkt_prepare = NULL;
break;
default:
rte_errno = EINVAL;
dev->data->port_id);
return -rte_errno;
}
+
+ rte_mb();
+ mp_init_msg(dev, &mp_res, param->type);
+ res->result = 0;
+ ret = rte_mp_reply(&mp_res, peer);
+
return ret;
}
+static bool
+mp_req_type_is_valid(enum hns3_mp_req_type type)
+{
+ return type == HNS3_MP_REQ_START_RXTX ||
+ type == HNS3_MP_REQ_STOP_RXTX ||
+ type == HNS3_MP_REQ_START_TX ||
+ type == HNS3_MP_REQ_STOP_TX;
+}
+
/*
* Broadcast request of stopping/starting data-path to secondary processes.
*
if (rte_eal_process_type() == RTE_PROC_SECONDARY || !hw->secondary_cnt)
return;
- if (type != HNS3_MP_REQ_START_RXTX && type != HNS3_MP_REQ_STOP_RXTX) {
+ if (!mp_req_type_is_valid(type)) {
hns3_err(hw, "port %u unknown request (req_type %d)",
dev->data->port_id, type);
return;
mp_req_on_rxtx(dev, HNS3_MP_REQ_STOP_RXTX);
}
+void
+hns3_mp_req_stop_tx(struct rte_eth_dev *dev)
+{
+ mp_req_on_rxtx(dev, HNS3_MP_REQ_STOP_TX);
+}
+
+void
+hns3_mp_req_start_tx(struct rte_eth_dev *dev)
+{
+ mp_req_on_rxtx(dev, HNS3_MP_REQ_START_TX);
+}
+
/*
* Initialize by primary process.
*/
const uint32_t *hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev);
void hns3_init_rx_ptype_tble(struct rte_eth_dev *dev);
void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev);
+eth_tx_burst_t hns3_get_tx_function(struct rte_eth_dev *dev,
+ eth_tx_prep_t *prep);
+uint16_t hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
+ struct rte_mbuf **pkts __rte_unused,
+ uint16_t pkts_n __rte_unused);
+
uint32_t hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id);
void hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id,
uint8_t gl_idx, uint16_t gl_value);