net/sfc: provide basic stubs for Tx subsystem

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ivan Malov 2016-11-29 16:19:23 +00:00 committed by Ferruh Yigit
parent 09a09b6f8b
commit a8ad8cf83f
8 changed files with 177 additions and 0 deletions

View File

@ -5,6 +5,8 @@
;
[Features]
Link status = Y
L3 checksum offload = P
L4 checksum offload = P
BSD nic_uio = Y
Linux UIO = Y
Linux VFIO = Y

View File

@ -46,6 +46,8 @@ SFC EFX PMD has support for:
- Link state information
- IPv4/IPv6 TCP/UDP transmit checksum offload
Non-supported Features
----------------------

View File

@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_intr.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_ev.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_port.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_rx.c
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_tx.c
VPATH += $(SRCDIR)/base

View File

@ -38,6 +38,7 @@
#include "sfc_log.h"
#include "sfc_ev.h"
#include "sfc_rx.h"
#include "sfc_tx.h"
int
@ -362,10 +363,17 @@ sfc_configure(struct sfc_adapter *sa)
if (rc != 0)
goto fail_rx_init;
rc = sfc_tx_init(sa);
if (rc != 0)
goto fail_tx_init;
sa->state = SFC_ADAPTER_CONFIGURED;
sfc_log_init(sa, "done");
return 0;
fail_tx_init:
sfc_rx_fini(sa);
fail_rx_init:
sfc_port_fini(sa);
@ -392,6 +400,7 @@ sfc_close(struct sfc_adapter *sa)
SFC_ASSERT(sa->state == SFC_ADAPTER_CONFIGURED);
sa->state = SFC_ADAPTER_CLOSING;
sfc_tx_fini(sa);
sfc_rx_fini(sa);
sfc_port_fini(sa);
sfc_ev_fini(sa);
@ -438,6 +447,7 @@ int
sfc_attach(struct sfc_adapter *sa)
{
struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
const efx_nic_cfg_t *encp;
efx_nic_t *enp;
int rc;
@ -488,6 +498,10 @@ sfc_attach(struct sfc_adapter *sa)
if (rc != 0)
goto fail_estimate_rsrc_limits;
encp = efx_nic_cfg_get(sa->nic);
sa->txq_max_entries = encp->enc_txq_max_ndescs;
SFC_ASSERT(rte_is_power_of_2(sa->txq_max_entries));
rc = sfc_intr_attach(sa);
if (rc != 0)
goto fail_intr_attach;

View File

@ -118,6 +118,7 @@ struct sfc_intr {
struct sfc_evq_info;
struct sfc_rxq_info;
struct sfc_txq_info;
struct sfc_port {
unsigned int flow_ctrl;
@ -151,6 +152,8 @@ struct sfc_adapter {
unsigned int rxq_max;
unsigned int txq_max;
unsigned int txq_max_entries;
unsigned int evq_count;
struct sfc_evq_info *evq_info;
@ -159,6 +162,9 @@ struct sfc_adapter {
unsigned int rxq_count;
struct sfc_rxq_info *rxq_info;
unsigned int txq_count;
struct sfc_txq_info *txq_info;
};
/*

View File

@ -52,16 +52,33 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
dev_info->max_rx_queues = sa->rxq_max;
dev_info->max_tx_queues = sa->txq_max;
/* By default packets are dropped if no descriptors are available */
dev_info->default_rxconf.rx_drop_en = 1;
dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
DEV_TX_OFFLOAD_TCP_CKSUM;
dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOVLANOFFL |
ETH_TXQ_FLAGS_NOXSUMSCTP;
dev_info->rx_desc_lim.nb_max = EFX_RXQ_MAXNDESCS;
dev_info->rx_desc_lim.nb_min = EFX_RXQ_MINNDESCS;
/* The RXQ hardware requires that the descriptor count is a power
* of 2, but rx_desc_lim cannot properly describe that constraint.
*/
dev_info->rx_desc_lim.nb_align = EFX_RXQ_MINNDESCS;
dev_info->tx_desc_lim.nb_max = sa->txq_max_entries;
dev_info->tx_desc_lim.nb_min = EFX_TXQ_MINNDESCS;
/*
* The TXQ hardware requires that the descriptor count is a power
* of 2, but tx_desc_lim cannot properly describe that constraint
*/
dev_info->tx_desc_lim.nb_align = EFX_TXQ_MINNDESCS;
}
static int

82
drivers/net/sfc/sfc_tx.c Normal file
View File

@ -0,0 +1,82 @@
/*-
* Copyright (c) 2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was jointly developed between OKTET Labs (under contract
* for Solarflare) and Solarflare Communications, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sfc.h"
#include "sfc_log.h"
#include "sfc_ev.h"
#include "sfc_tx.h"
static int
sfc_tx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)
{
sfc_log_init(sa, "TxQ = %u", sw_index);
return 0;
}
int
sfc_tx_init(struct sfc_adapter *sa)
{
unsigned int sw_index;
int rc = 0;
sa->txq_count = sa->eth_dev->data->nb_tx_queues;
sa->txq_info = rte_calloc_socket("sfc-txqs", sa->txq_count,
sizeof(sa->txq_info[0]), 0,
sa->socket_id);
if (sa->txq_info == NULL)
goto fail_txqs_alloc;
for (sw_index = 0; sw_index < sa->txq_count; ++sw_index) {
rc = sfc_tx_qinit_info(sa, sw_index);
if (rc != 0)
goto fail_tx_qinit_info;
}
return 0;
fail_tx_qinit_info:
rte_free(sa->txq_info);
sa->txq_info = NULL;
fail_txqs_alloc:
sa->txq_count = 0;
sfc_log_init(sa, "failed (rc = %d)", rc);
return rc;
}
void
sfc_tx_fini(struct sfc_adapter *sa)
{
rte_free(sa->txq_info);
sa->txq_info = NULL;
sa->txq_count = 0;
}

53
drivers/net/sfc/sfc_tx.h Normal file
View File

@ -0,0 +1,53 @@
/*-
* Copyright (c) 2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was jointly developed between OKTET Labs (under contract
* for Solarflare) and Solarflare Communications, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SFC_TX_H
#define _SFC_TX_H
#include <rte_mbuf.h>
#include <rte_ethdev.h>
#include "efx.h"
#ifdef __cplusplus
extern "C" {
#endif
struct sfc_adapter;
struct sfc_txq_info {
};
int sfc_tx_init(struct sfc_adapter *sa);
void sfc_tx_fini(struct sfc_adapter *sa);
#ifdef __cplusplus
}
#endif
#endif /* _SFC_TX_H */