net/mlx4: remove unnecessary wrapper functions
Wrapper functions whose main purpose was to take a lock on the private structure are no longer needed since this lock does not exist anymore. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
parent
e4dff4d83d
commit
3cf06cea7c
@ -417,10 +417,10 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device MTU.
|
||||
* DPDK callback to change the MTU.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
* Pointer to Ethernet device structure.
|
||||
* @param mtu
|
||||
* MTU value to set.
|
||||
*
|
||||
@ -428,8 +428,9 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
|
||||
* 0 on success, negative errno value otherwise and rte_errno is set.
|
||||
*/
|
||||
static int
|
||||
priv_set_mtu(struct priv *priv, uint16_t mtu)
|
||||
mlx4_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
uint16_t new_mtu;
|
||||
int ret = priv_set_sysfs_ulong(priv, "mtu", mtu);
|
||||
|
||||
@ -438,8 +439,10 @@ priv_set_mtu(struct priv *priv, uint16_t mtu)
|
||||
ret = priv_get_mtu(priv, &new_mtu);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (new_mtu == mtu)
|
||||
if (new_mtu == mtu) {
|
||||
priv->mtu = mtu;
|
||||
return 0;
|
||||
}
|
||||
rte_errno = EINVAL;
|
||||
return -rte_errno;
|
||||
}
|
||||
@ -491,7 +494,7 @@ static void
|
||||
priv_mac_addr_del(struct priv *priv);
|
||||
|
||||
/**
|
||||
* Ethernet device configuration.
|
||||
* DPDK callback for Ethernet device configuration.
|
||||
*
|
||||
* Prepare the driver for a given number of TX and RX queues.
|
||||
*
|
||||
@ -502,7 +505,7 @@ priv_mac_addr_del(struct priv *priv);
|
||||
* 0 on success, negative errno value otherwise and rte_errno is set.
|
||||
*/
|
||||
static int
|
||||
dev_configure(struct rte_eth_dev *dev)
|
||||
mlx4_dev_configure(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
unsigned int rxqs_n = dev->data->nb_rx_queues;
|
||||
@ -523,21 +526,6 @@ dev_configure(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback for Ethernet device configuration.
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to Ethernet device structure.
|
||||
*
|
||||
* @return
|
||||
* 0 on success, negative errno value otherwise and rte_errno is set.
|
||||
*/
|
||||
static int
|
||||
mlx4_dev_configure(struct rte_eth_dev *dev)
|
||||
{
|
||||
return dev_configure(dev);
|
||||
}
|
||||
|
||||
static uint16_t mlx4_tx_burst(void *, struct rte_mbuf **, uint16_t);
|
||||
static uint16_t removed_rx_burst(void *, struct rte_mbuf **, uint16_t);
|
||||
|
||||
@ -2456,37 +2444,6 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to change the MTU.
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to Ethernet device structure.
|
||||
* @param in_mtu
|
||||
* New MTU.
|
||||
*
|
||||
* @return
|
||||
* 0 on success, negative errno value otherwise and rte_errno is set.
|
||||
*/
|
||||
static int
|
||||
mlx4_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
int ret = 0;
|
||||
|
||||
/* Set kernel interface MTU first. */
|
||||
if (priv_set_mtu(priv, mtu)) {
|
||||
ret = rte_errno;
|
||||
WARN("cannot set port %u MTU to %u: %s", priv->port, mtu,
|
||||
strerror(rte_errno));
|
||||
goto out;
|
||||
} else
|
||||
DEBUG("adapter port %u MTU set to %u", priv->port, mtu);
|
||||
priv->mtu = mtu;
|
||||
out:
|
||||
assert(ret >= 0);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get flow control status.
|
||||
*
|
||||
|
@ -837,29 +837,19 @@ priv_flow_create_action_queue(struct priv *priv,
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a flow.
|
||||
* Create a flow.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
* @param[in] attr
|
||||
* Flow rule attributes.
|
||||
* @param[in] items
|
||||
* Pattern specification (list terminated by the END pattern item).
|
||||
* @param[in] actions
|
||||
* Associated actions (list terminated by the END action).
|
||||
* @param[out] error
|
||||
* Perform verbose error reporting if not NULL.
|
||||
*
|
||||
* @return
|
||||
* A flow on success, NULL otherwise.
|
||||
* @see rte_flow_create()
|
||||
* @see rte_flow_ops
|
||||
*/
|
||||
static struct rte_flow *
|
||||
priv_flow_create(struct priv *priv,
|
||||
struct rte_flow *
|
||||
mlx4_flow_create(struct rte_eth_dev *dev,
|
||||
const struct rte_flow_attr *attr,
|
||||
const struct rte_flow_item items[],
|
||||
const struct rte_flow_action actions[],
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
struct rte_flow *rte_flow;
|
||||
struct mlx4_flow_action action;
|
||||
struct mlx4_flow flow = { .offset = sizeof(struct ibv_flow_attr), };
|
||||
@ -909,37 +899,16 @@ priv_flow_create(struct priv *priv,
|
||||
}
|
||||
rte_flow = priv_flow_create_action_queue(priv, flow.ibv_attr,
|
||||
&action, error);
|
||||
if (rte_flow)
|
||||
if (rte_flow) {
|
||||
LIST_INSERT_HEAD(&priv->flows, rte_flow, next);
|
||||
DEBUG("Flow created %p", (void *)rte_flow);
|
||||
return rte_flow;
|
||||
}
|
||||
exit:
|
||||
rte_free(flow.ibv_attr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a flow.
|
||||
*
|
||||
* @see rte_flow_create()
|
||||
* @see rte_flow_ops
|
||||
*/
|
||||
struct rte_flow *
|
||||
mlx4_flow_create(struct rte_eth_dev *dev,
|
||||
const struct rte_flow_attr *attr,
|
||||
const struct rte_flow_item items[],
|
||||
const struct rte_flow_action actions[],
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
struct rte_flow *flow;
|
||||
|
||||
flow = priv_flow_create(priv, attr, items, actions, error);
|
||||
if (flow) {
|
||||
LIST_INSERT_HEAD(&priv->flows, flow, next);
|
||||
DEBUG("Flow created %p", (void *)flow);
|
||||
}
|
||||
return flow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see rte_flow_isolate()
|
||||
*
|
||||
@ -974,26 +943,6 @@ mlx4_flow_isolate(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a flow.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
* @param[in] flow
|
||||
* Flow to destroy.
|
||||
*/
|
||||
static void
|
||||
priv_flow_destroy(struct priv *priv, struct rte_flow *flow)
|
||||
{
|
||||
(void)priv;
|
||||
LIST_REMOVE(flow, next);
|
||||
if (flow->ibv_flow)
|
||||
claim_zero(ibv_destroy_flow(flow->ibv_flow));
|
||||
rte_free(flow->ibv_attr);
|
||||
DEBUG("Flow destroyed %p", (void *)flow);
|
||||
rte_free(flow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a flow.
|
||||
*
|
||||
@ -1005,30 +954,17 @@ mlx4_flow_destroy(struct rte_eth_dev *dev,
|
||||
struct rte_flow *flow,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
|
||||
(void)dev;
|
||||
(void)error;
|
||||
priv_flow_destroy(priv, flow);
|
||||
LIST_REMOVE(flow, next);
|
||||
if (flow->ibv_flow)
|
||||
claim_zero(ibv_destroy_flow(flow->ibv_flow));
|
||||
rte_free(flow->ibv_attr);
|
||||
DEBUG("Flow destroyed %p", (void *)flow);
|
||||
rte_free(flow);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy all flows.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
*/
|
||||
static void
|
||||
priv_flow_flush(struct priv *priv)
|
||||
{
|
||||
while (!LIST_EMPTY(&priv->flows)) {
|
||||
struct rte_flow *flow;
|
||||
|
||||
flow = LIST_FIRST(&priv->flows);
|
||||
priv_flow_destroy(priv, flow);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy all flows.
|
||||
*
|
||||
@ -1041,8 +977,12 @@ mlx4_flow_flush(struct rte_eth_dev *dev,
|
||||
{
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
|
||||
(void)error;
|
||||
priv_flow_flush(priv);
|
||||
while (!LIST_EMPTY(&priv->flows)) {
|
||||
struct rte_flow *flow;
|
||||
|
||||
flow = LIST_FIRST(&priv->flows);
|
||||
mlx4_flow_destroy(dev, flow, error);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user