MCPcopy Create free account
hub / github.com/F-Stack/f-stack / i40e_rx_queue_init

Function i40e_rx_queue_init

dpdk/drivers/net/i40e/i40e_rxtx.c:2944–3015  ·  view source on GitHub ↗

Init the RX queue in hardware */

Source from the content-addressed store, hash-verified

2942
2943/* Init the RX queue in hardware */
2944int
2945i40e_rx_queue_init(struct i40e_rx_queue *rxq)
2946{
2947 int err = I40E_SUCCESS;
2948 struct i40e_hw *hw = I40E_VSI_TO_HW(rxq->vsi);
2949 struct rte_eth_dev_data *dev_data = I40E_VSI_TO_DEV_DATA(rxq->vsi);
2950 uint16_t pf_q = rxq->reg_idx;
2951 uint16_t buf_size;
2952 struct i40e_hmc_obj_rxq rx_ctx;
2953
2954 err = i40e_rx_queue_config(rxq);
2955 if (err < 0) {
2956 PMD_DRV_LOG(ERR, "Failed to config RX queue");
2957 return err;
2958 }
2959
2960 /* Clear the context structure first */
2961 memset(&rx_ctx, 0, sizeof(struct i40e_hmc_obj_rxq));
2962 rx_ctx.dbuff = rxq->rx_buf_len >> I40E_RXQ_CTX_DBUFF_SHIFT;
2963 rx_ctx.hbuff = rxq->rx_hdr_len >> I40E_RXQ_CTX_HBUFF_SHIFT;
2964
2965 rx_ctx.base = rxq->rx_ring_phys_addr / I40E_QUEUE_BASE_ADDR_UNIT;
2966 rx_ctx.qlen = rxq->nb_rx_desc;
2967#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
2968 rx_ctx.dsize = 1;
2969#endif
2970 rx_ctx.dtype = rxq->hs_mode;
2971 if (rxq->hs_mode)
2972 rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_ALL;
2973 else
2974 rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
2975 rx_ctx.rxmax = rxq->max_pkt_len;
2976 rx_ctx.tphrdesc_ena = 1;
2977 rx_ctx.tphwdesc_ena = 1;
2978 rx_ctx.tphdata_ena = 1;
2979 rx_ctx.tphhead_ena = 1;
2980 rx_ctx.lrxqthresh = 2;
2981 rx_ctx.crcstrip = (rxq->crc_len == 0) ? 1 : 0;
2982 rx_ctx.l2tsel = 1;
2983 /* showiv indicates if inner VLAN is stripped inside of tunnel
2984 * packet. When set it to 1, vlan information is stripped from
2985 * the inner header, but the hardware does not put it in the
2986 * descriptor. So set it zero by default.
2987 */
2988 rx_ctx.showiv = 0;
2989 rx_ctx.prefena = 1;
2990
2991 err = i40e_clear_lan_rx_queue_context(hw, pf_q);
2992 if (err != I40E_SUCCESS) {
2993 PMD_DRV_LOG(ERR, "Failed to clear LAN RX queue context");
2994 return err;
2995 }
2996 err = i40e_set_lan_rx_queue_context(hw, pf_q, &rx_ctx);
2997 if (err != I40E_SUCCESS) {
2998 PMD_DRV_LOG(ERR, "Failed to set LAN RX queue context");
2999 return err;
3000 }
3001

Callers 2

i40e_dev_rx_initFunction · 0.85

Calls 5

i40e_rx_queue_configFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected