net/octeontx2: support link status
Adding a new callback for reading the link status. PF can read it's link status and can forward the same to VF once it comes up. Signed-off-by: Harman Kalra <hkalra@marvell.com> Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
parent
cb8d769fb6
commit
eebc26d994
@ -42,7 +42,8 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)
|
|||||||
|
|
||||||
static const struct otx2_dev_ops otx2_dev_ops = {
|
static const struct otx2_dev_ops otx2_dev_ops = {
|
||||||
.link_status_update = otx2_eth_dev_link_status_update,
|
.link_status_update = otx2_eth_dev_link_status_update,
|
||||||
.ptp_info_update = otx2_eth_dev_ptp_info_update
|
.ptp_info_update = otx2_eth_dev_ptp_info_update,
|
||||||
|
.link_status_get = otx2_eth_dev_link_status_get,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2635,6 +2636,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
|
|||||||
|
|
||||||
nix_cgx_stop_link_event(dev);
|
nix_cgx_stop_link_event(dev);
|
||||||
|
|
||||||
|
/* Unregister the dev ops, this is required to stop VFs from
|
||||||
|
* receiving link status updates on exit path.
|
||||||
|
*/
|
||||||
|
dev->ops = NULL;
|
||||||
|
|
||||||
/* Free up SQs */
|
/* Free up SQs */
|
||||||
for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
|
for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
|
||||||
otx2_nix_tx_queue_release(eth_dev->data->tx_queues[i]);
|
otx2_nix_tx_queue_release(eth_dev->data->tx_queues[i]);
|
||||||
|
@ -464,6 +464,8 @@ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set);
|
|||||||
int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
|
int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
|
||||||
void otx2_eth_dev_link_status_update(struct otx2_dev *dev,
|
void otx2_eth_dev_link_status_update(struct otx2_dev *dev,
|
||||||
struct cgx_link_user_info *link);
|
struct cgx_link_user_info *link);
|
||||||
|
void otx2_eth_dev_link_status_get(struct otx2_dev *dev,
|
||||||
|
struct cgx_link_user_info *link);
|
||||||
int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev);
|
int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev);
|
||||||
int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev);
|
int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev);
|
||||||
int otx2_apply_link_speed(struct rte_eth_dev *eth_dev);
|
int otx2_apply_link_speed(struct rte_eth_dev *eth_dev);
|
||||||
|
@ -47,6 +47,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link)
|
|||||||
otx2_info("Port %d: Link Down", (int)(eth_dev->data->port_id));
|
otx2_info("Port %d: Link Down", (int)(eth_dev->data->port_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
otx2_eth_dev_link_status_get(struct otx2_dev *dev,
|
||||||
|
struct cgx_link_user_info *link)
|
||||||
|
{
|
||||||
|
struct otx2_eth_dev *otx2_dev = (struct otx2_eth_dev *)dev;
|
||||||
|
struct rte_eth_link eth_link;
|
||||||
|
struct rte_eth_dev *eth_dev;
|
||||||
|
|
||||||
|
if (!link || !dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
eth_dev = otx2_dev->eth_dev;
|
||||||
|
if (!eth_dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rte_eth_linkstatus_get(eth_dev, ð_link);
|
||||||
|
|
||||||
|
link->link_up = eth_link.link_status;
|
||||||
|
link->speed = eth_link.link_speed;
|
||||||
|
link->an = eth_link.link_autoneg;
|
||||||
|
link->full_duplex = eth_link.link_duplex;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
otx2_eth_dev_link_status_update(struct otx2_dev *dev,
|
otx2_eth_dev_link_status_update(struct otx2_dev *dev,
|
||||||
struct cgx_link_user_info *link)
|
struct cgx_link_user_info *link)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user