Skip to content

Commit

Permalink
octeon_ep_vf: add VF-PF mailbox communication.
Browse files Browse the repository at this point in the history
Implement VF-PF mailbox to send all control commands from VF to PF
and receive responses and notifications from PF to VF.

Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shinas Rasheed authored and David S. Miller committed Feb 12, 2024
1 parent 2c0c32c commit c5cb944
Show file tree
Hide file tree
Showing 4 changed files with 509 additions and 2 deletions.
30 changes: 30 additions & 0 deletions drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ static netdev_tx_t octep_vf_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}

int octep_vf_get_link_info(struct octep_vf_device *oct)
{
int ret, size;

ret = octep_vf_mbox_bulk_read(oct, OCTEP_PFVF_MBOX_CMD_GET_LINK_INFO,
(u8 *)&oct->link_info, &size);
if (ret) {
dev_err(&oct->pdev->dev, "Get VF link info failed via VF Mbox\n");
return ret;
}
return 0;
}

/**
* octep_vf_tx_timeout_task - work queue task to Handle Tx queue timeout.
*
Expand Down Expand Up @@ -412,11 +425,28 @@ static int octep_vf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto delete_mbox;
}

if (octep_vf_mbox_get_fw_info(octep_vf_dev)) {
dev_err(&pdev->dev, "unable to get fw info\n");
err = -EINVAL;
goto delete_mbox;
}

netdev->hw_features = NETIF_F_SG;
if (OCTEP_VF_TX_IP_CSUM(octep_vf_dev->fw_info.tx_ol_flags))
netdev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);

if (OCTEP_VF_RX_IP_CSUM(octep_vf_dev->fw_info.rx_ol_flags))
netdev->hw_features |= NETIF_F_RXCSUM;

netdev->min_mtu = OCTEP_VF_MIN_MTU;
netdev->max_mtu = OCTEP_VF_MAX_MTU;
netdev->mtu = OCTEP_VF_DEFAULT_MTU;

if (OCTEP_VF_TX_TSO(octep_vf_dev->fw_info.tx_ol_flags)) {
netdev->hw_features |= NETIF_F_TSO;
netif_set_tso_max_size(netdev, netdev->max_mtu);
}

netdev->features |= netdev->hw_features;
octep_vf_get_mac_addr(octep_vf_dev, octep_vf_dev->mac_addr);
eth_hw_addr_set(netdev, octep_vf_dev->mac_addr);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,7 @@ void octep_vf_device_setup_cn93(struct octep_vf_device *oct);
void octep_vf_device_setup_cnxk(struct octep_vf_device *oct);
int octep_vf_iq_process_completions(struct octep_vf_iq *iq, u16 budget);
int octep_vf_oq_process_rx(struct octep_vf_oq *oq, int budget);
int octep_vf_get_link_info(struct octep_vf_device *oct);
int octep_vf_get_if_stats(struct octep_vf_device *oct);
void octep_vf_mbox_work(struct work_struct *work);
#endif /* _OCTEP_VF_MAIN_H_ */
Loading

0 comments on commit c5cb944

Please sign in to comment.