rsp->rc = msg->rc;
rsp->pcifunc = msg->pcifunc;
+ /* Whenever a PF comes up, AF sends the link status to it but
+ * when VF comes up no such event is sent to respective VF.
+ * Using MBOX_MSG_NIX_LF_START_RX response from AF for the
+ * purpose and send the link status of PF to VF.
+ */
+ if (msg->id == MBOX_MSG_NIX_LF_START_RX) {
+ /* Send link status to VF */
+ struct cgx_link_user_info linfo;
+ struct mbox_msghdr *vf_msg;
+ size_t sz;
+
+ /* Get the link status */
+ memset(&linfo, 0, sizeof(struct cgx_link_user_info));
+ if (dev->ops && dev->ops->link_status_get)
+ dev->ops->link_status_get(dev->roc_nix, &linfo);
+
+ sz = PLT_ALIGN(mbox_id2size(MBOX_MSG_CGX_LINK_EVENT),
+ MBOX_MSG_ALIGN);
+ /* Prepare the message to be sent */
+ vf_msg = mbox_alloc_msg(&dev->mbox_vfpf_up, vf, sz);
+ if (vf_msg) {
+ mbox_req_init(MBOX_MSG_CGX_LINK_EVENT, vf_msg);
+ memcpy((uint8_t *)vf_msg +
+ sizeof(struct mbox_msghdr), &linfo,
+ sizeof(struct cgx_link_user_info));
+
+ vf_msg->rc = msg->rc;
+ vf_msg->pcifunc = msg->pcifunc;
+ /* Send to VF */
+ mbox_msg_send(&dev->mbox_vfpf_up, vf);
+ }
+ }
+
offset = mbox->rx_start + msg->next_msgoff;
}
plt_spinlock_unlock(&mdev->mbox_lock);
/* PTP info callback */
typedef int (*ptp_info_t)(void *roc_nix, bool enable);
+/* Link status get callback */
+typedef void (*link_status_get_t)(void *roc_nix,
+ struct cgx_link_user_info *link);
+
struct dev_ops {
link_info_t link_status_update;
ptp_info_t ptp_info_update;
+ link_status_get_t link_status_get;
};
#define dev_is_vf(dev) ((dev)->hwcap & DEV_HWCAP_F_VF)
/* PTP info update callback */
typedef int (*ptp_info_update_t)(struct roc_nix *roc_nix, bool enable);
+/* Link status get callback */
+typedef void (*link_info_get_t)(struct roc_nix *roc_nix,
+ struct roc_nix_link_info *link);
+
struct roc_nix {
/* Input parameters */
struct plt_pci_device *pci_dev;
int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix,
link_status_t link_update);
void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix);
+int __roc_api roc_nix_mac_link_info_get_cb_register(
+ struct roc_nix *roc_nix, link_info_get_t link_info_get);
+void __roc_api roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix);
/* Ops */
int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix,
dev->ops->link_status_update = NULL;
}
+
+int
+roc_nix_mac_link_info_get_cb_register(struct roc_nix *roc_nix,
+ link_info_get_t link_info_get)
+{
+ struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+ struct dev *dev = &nix->dev;
+
+ if (link_info_get == NULL)
+ return NIX_ERR_PARAM;
+
+ dev->ops->link_status_get = (link_info_t)link_info_get;
+ return 0;
+}
+
+void
+roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix)
+{
+ struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+ struct dev *dev = &nix->dev;
+
+ dev->ops->link_status_get = NULL;
+}
roc_nix_mac_addr_set;
roc_nix_mac_link_cb_register;
roc_nix_mac_link_cb_unregister;
+ roc_nix_mac_link_info_get_cb_register;
+ roc_nix_mac_link_info_get_cb_unregister;
roc_nix_mac_link_event_start_stop;
roc_nix_mac_link_info_get;
roc_nix_mac_link_info_set;