diff options
| author | Lu Qiuwen <[email protected]> | 2022-11-22 14:30:02 +0800 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2022-12-23 01:52:28 -0500 |
| commit | c6ed62c5ef21991cf79efe66ac35865afd06ac70 (patch) | |
| tree | ccf845638c3aa68fa6260d8f801f511edd19a360 /service/src/node_shmdev.c | |
| parent | b82e5be5a3bdab64348b6ef85fc225746266736d (diff) | |
适配新接口,编译通过。
Diffstat (limited to 'service/src/node_shmdev.c')
| -rw-r--r-- | service/src/node_shmdev.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/service/src/node_shmdev.c b/service/src/node_shmdev.c index c063faf..8647090 100644 --- a/service/src/node_shmdev.c +++ b/service/src/node_shmdev.c @@ -152,9 +152,12 @@ int parser_vlan_flipping_adapter_conf(struct sc_main * sc, struct vlan_flipping_ struct default_si_table * _default_si_table_item = &_vlan_flipping_adapter->default_si_table_array[vdev->port_id]; + if (_default_si_table_item->init_flg != 0) + { + _default_si_table_item = &_vlan_flipping_adapter->default_si_table_array[vdev->port_id]; + } - _default_si_table_item = &_vlan_flipping_adapter->default_si_table_array[vdev->port_id]; if (_default_si_table_item->init_flg == 0) { MR_ERROR("Vlan flipping adapter : 'enable_devices',the device '%s' no config 'default_si_table'.", @@ -167,9 +170,8 @@ int parser_vlan_flipping_adapter_conf(struct sc_main * sc, struct vlan_flipping_ } /* Parsing enable config */ - unsigned int adapter_enable = MR_VLAN_FLIPPING_ADAPTER_DISABLE; - MESA_load_profile_uint_def(sc->local_cfgfile, "vlan_flipping_adapter", "enable", &adapter_enable, - MR_VLAN_FLIPPING_ADAPTER_DISABLE); + unsigned int en_adapter = 0; + MESA_load_profile_uint_def(sc->local_cfgfile, "vlan_flipping_adapter", "enable", &en_adapter, 0); /* Parsing vlan range */ unsigned int etherfabric_vlan_range_start, etherfabric_vlan_range_end; @@ -200,7 +202,7 @@ int parser_vlan_flipping_adapter_conf(struct sc_main * sc, struct vlan_flipping_ return RT_ERR; } - _vlan_flipping_adapter->enable = adapter_enable; + _vlan_flipping_adapter->enable = en_adapter; _vlan_flipping_adapter->etherfabric_vlan_range_start = etherfabric_vlan_range_start; _vlan_flipping_adapter->etherfabric_vlan_range_end = etherfabric_vlan_range_end; _vlan_flipping_adapter->virtual_wire_vlan_range_start = virtual_wire_vlan_range_start; @@ -266,7 +268,7 @@ void vlan_flipping_adapter_decode(struct private_data * private_ctrlzone, uint16 private_ctrlzone->si_id = _default_si_table_item->default_si + 1; } -__rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, struct rte_node * node, +uint16_t shmdev_rx_node_process(struct rte_graph * graph, struct rte_node * node, void ** objs, uint16_t cnt) { struct dev_node_ctx * ctx = (struct dev_node_ctx *)node->ctx; @@ -288,7 +290,7 @@ __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, st node->idx = rx_nr_mbufs; /* Get stream for the speculated next node */ - unsigned int next_index = SHMDEV_RX_NEXT_CLASSIFIER; + unsigned int next_index = 0; void ** to_next = rte_node_next_stream_get(graph, node, next_index, rx_nr_mbufs); void ** from = (void **)node->objs; unsigned int n_left_from = rx_nr_mbufs; @@ -303,7 +305,7 @@ __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, st { struct rte_mbuf * mbuf0 = mbufs[0]; struct private_data * private_ctrlzone = mrbuf_cz_data(mbuf0, MR_NODE_CTRLZONE_ID); - unsigned int next0 = SHMDEV_RX_NEXT_CLASSIFIER; + unsigned int next0 = 0; assert(mbuf0 != NULL); assert(private_ctrlzone != NULL); @@ -321,16 +323,16 @@ __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, st { /* Parse pkt */ memset(private_ctrlzone, 0, sizeof(struct private_data)); - private_ctrlzone->port_egress_is_shmdev = 1; + struct pkt_parser * pkt_parser_ptr = &private_ctrlzone->pkt_parser; MR_SHMDEV_STAT_ADD(shmdev_graph_stat, graph->id, new_create_pkt, 1); + pkt_parser_init(pkt_parser_ptr, LAYER_TYPE_ALL, MR_PKT_PARSE_RESULT_MAX); complex_parser_ether(pkt_parser_ptr, rte_pktmbuf_mtod(mbuf0, const char *)); - /* Vlan flipping adapter decode */ - if ((_global_vlan_flipping_adapter->enable == MR_VLAN_FLIPPING_ADAPTER_ENABLE) && - (_default_si_table_item->vdev_enable == MR_VLAN_FLIPPING_ADAPTER_DEVICE_ENABLE)) - struct default_si_table * _default_si_table_item = &g_vlan_flipping_adapter->default_si_table_array[dev_desc->port_id]; + struct default_si_table * _default_si_table_item = + &g_vlan_flipping_adapter->default_si_table_array[dev_desc->port_id]; + if (g_vlan_flipping_adapter->enable && _default_si_table_item->vdev_enable) { uint16_t vlan_id = mbuf0->vlan_tci; @@ -345,23 +347,6 @@ __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, st } } - /* Parsed pkt head */ - struct pkt_head_info pkt_head_info_item = {}; - int ret = get_pkt_head_info(&private_ctrlzone->pkt_parser, &pkt_head_info_item, MR_PARSE_ETHER); - if (unlikely(ret == RT_ERR)) - { - MR_SHMDEV_STAT_ADD(shmdev_graph_stat, graph->id, no_eth_hdr_pkt, 1); - MR_SHMDEV_STAT_ADD(shmdev_graph_stat, graph->id, to_classifier_pkt, 1); - last_spec += 1; - continue; - } - - if (pkt_head_info_item._ether_hdr->ether_type == HEALTH_CHECK_PRIVATE) - { - next0 = SHMDEV_RX_NEXT_PRIVATE_HEALTH_CHECK; - MR_SHMDEV_STAT_ADD(shmdev_graph_stat, graph->id, to_private_health_check_pkt, 1); - } - if (unlikely(next_index ^ next0)) { /* Copy things successfully speculated till now */ @@ -395,7 +380,7 @@ __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * graph, st return rx_nr_mbufs; } -__rte_always_inline uint16_t shmdev_tx_node_process(struct rte_graph * graph, struct rte_node * node, +uint16_t shmdev_tx_node_process(struct rte_graph * graph, struct rte_node * node, void ** objs, uint16_t cnt) { struct dev_node_ctx * ctx = (struct dev_node_ctx *)node->ctx; @@ -430,7 +415,7 @@ __rte_always_inline uint16_t shmdev_tx_node_process(struct rte_graph * graph, st /* Pkt encode */ uint16_t vlan_id = vlan_flipping_adapter_encode(dir, fwd_table_index, vlan_range_start); - mbufs[i]->ol_flags = PKT_RX_VLAN; + mbufs[i]->ol_flags = RTE_MBUF_F_RX_VLAN; mbufs[i]->vlan_tci = vlan_id; } } |
