X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_txq.c;h=f128c3d1a5b8a65f74cf0adcffcf375e91a8fa18;hb=fe3620aabacd504a2b6c807bd0abe18cc1a2da12;hp=56e0937ca3ee5864fb0a7616e280e606f0d39cc3;hpb=91d1cfafc977ccb224d4632b12952360934499f2;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 56e0937ca3..f128c3d1a5 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -100,34 +100,36 @@ mlx5_get_tx_port_offloads(struct rte_eth_dev *dev) struct mlx5_priv *priv = dev->data->dev_private; uint64_t offloads = (RTE_ETH_TX_OFFLOAD_MULTI_SEGS | RTE_ETH_TX_OFFLOAD_VLAN_INSERT); - struct mlx5_dev_config *config = &priv->config; + struct mlx5_port_config *config = &priv->config; + struct mlx5_dev_cap *dev_cap = &priv->sh->dev_cap; - if (config->hw_csum) + if (dev_cap->hw_csum) offloads |= (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM); - if (config->tso) + if (dev_cap->tso) offloads |= RTE_ETH_TX_OFFLOAD_TCP_TSO; - if (config->tx_pp) + if (priv->sh->config.tx_pp || + priv->sh->cdev->config.hca_attr.wait_on_time) offloads |= RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP; - if (config->swp) { - if (config->swp & MLX5_SW_PARSING_CSUM_CAP) + if (dev_cap->swp) { + if (dev_cap->swp & MLX5_SW_PARSING_CSUM_CAP) offloads |= RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM; - if (config->swp & MLX5_SW_PARSING_TSO_CAP) + if (dev_cap->swp & MLX5_SW_PARSING_TSO_CAP) offloads |= (RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO); } - if (config->tunnel_en) { - if (config->hw_csum) + if (dev_cap->tunnel_en) { + if (dev_cap->hw_csum) offloads |= RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM; - if (config->tso) { - if (config->tunnel_en & + if (dev_cap->tso) { + if (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_VXLAN_CAP) offloads |= RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO; - if (config->tunnel_en & + if (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_GRE_CAP) offloads |= RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO; - if (config->tunnel_en & + if (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_GENEVE_CAP) offloads |= RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO; } @@ -740,7 +742,8 @@ static void txq_set_params(struct mlx5_txq_ctrl *txq_ctrl) { struct mlx5_priv *priv = txq_ctrl->priv; - struct mlx5_dev_config *config = &priv->config; + struct mlx5_port_config *config = &priv->config; + struct mlx5_dev_cap *dev_cap = &priv->sh->dev_cap; unsigned int inlen_send; /* Inline data for ordinary SEND.*/ unsigned int inlen_empw; /* Inline data for enhanced MPW. */ unsigned int inlen_mode; /* Minimal required Inline data. */ @@ -924,19 +927,19 @@ txq_set_params(struct mlx5_txq_ctrl *txq_ctrl) txq_ctrl->txq.tso_en = 1; } if (((RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO & txq_ctrl->txq.offloads) && - (config->tunnel_en & MLX5_TUNNELED_OFFLOADS_VXLAN_CAP)) | + (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_VXLAN_CAP)) | ((RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO & txq_ctrl->txq.offloads) && - (config->tunnel_en & MLX5_TUNNELED_OFFLOADS_GRE_CAP)) | + (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_GRE_CAP)) | ((RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO & txq_ctrl->txq.offloads) && - (config->tunnel_en & MLX5_TUNNELED_OFFLOADS_GENEVE_CAP)) | - (config->swp & MLX5_SW_PARSING_TSO_CAP)) + (dev_cap->tunnel_en & MLX5_TUNNELED_OFFLOADS_GENEVE_CAP)) | + (dev_cap->swp & MLX5_SW_PARSING_TSO_CAP)) txq_ctrl->txq.tunnel_en = 1; txq_ctrl->txq.swp_en = (((RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO) & - txq_ctrl->txq.offloads) && (config->swp & + txq_ctrl->txq.offloads) && (dev_cap->swp & MLX5_SW_PARSING_TSO_CAP)) | ((RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM & - txq_ctrl->txq.offloads) && (config->swp & + txq_ctrl->txq.offloads) && (dev_cap->swp & MLX5_SW_PARSING_CSUM_CAP)); } @@ -958,7 +961,7 @@ static int txq_adjust_params(struct mlx5_txq_ctrl *txq_ctrl) { struct mlx5_priv *priv = txq_ctrl->priv; - struct mlx5_dev_config *config = &priv->config; + struct mlx5_port_config *config = &priv->config; unsigned int max_inline; max_inline = txq_calc_inline_max(txq_ctrl); @@ -1286,12 +1289,21 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) int off, nbit; unsigned int i; uint64_t mask = 0; + uint64_t ts_mask; + if (sh->dev_cap.rt_timestamp || + !sh->cdev->config.hca_attr.dev_freq_khz) + ts_mask = MLX5_TS_MASK_SECS << 32; + else + ts_mask = rte_align64pow2(MLX5_TS_MASK_SECS * 1000ull * + sh->cdev->config.hca_attr.dev_freq_khz); + ts_mask = rte_cpu_to_be_64(ts_mask - 1ull); nbit = rte_mbuf_dynflag_lookup (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); off = rte_mbuf_dynfield_lookup (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); - if (nbit >= 0 && off >= 0 && sh->txpp.refcnt) + if (nbit >= 0 && off >= 0 && + (sh->txpp.refcnt || priv->sh->cdev->config.hca_attr.wait_on_time)) mask = 1ULL << nbit; for (i = 0; i != priv->txqs_n; ++i) { data = (*priv->txqs)[i]; @@ -1300,5 +1312,9 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) data->sh = sh; data->ts_mask = mask; data->ts_offset = off; + data->rt_timestamp = sh->dev_cap.rt_timestamp; + data->rt_timemask = (data->offloads & + RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP) ? + ts_mask : 0; } }