Stephen Wang <wstep...@codeaurora.org> :
> This driver adds support for the internal GMACs on IPQ806x SoCs.
> It supports the device-tree and will register up to 4 ethernet
> interfaces.
> 
> Signed-off-by: Stephen Wang <wstep...@codeaurora.org>
> ---
[...]
> +/*
> + * NSS GMAC data plane ops, default would be slowpath and can be override by
> + * nss-drv
> + */
> +struct nss_gmac_data_plane_ops {
> +     int (*open)(void *ctx, uint32_t tx_desc_ring, uint32_t rx_desc_ring,
> +                                                     uint32_t mode);
> +     int (*close)(void *ctx);
> +     int (*link_state)(void *ctx, uint32_t link_state);
> +     int (*mac_addr)(void *ctx, uint8_t *addr);
> +     int (*change_mtu)(void *ctx, uint32_t mtu);
> +     int (*xmit)(void *ctx, struct sk_buff *os_buf);
> +};

Weak types.

[...]
> +/*
> + * nss_gmac_register_offload()
> + *
> + * @param[netdev] netdev instance that is going to register
> + * @param[dp_ops] dataplan ops for chaning mac addr/mtu/link status
> + * @param[ctx] passing the ctx of this nss_phy_if to gmac
> + *
> + * @return Return SUCCESS or FAILURE
> + */
> +int nss_gmac_override_data_plane(struct net_device *netdev,
> +                             struct nss_gmac_data_plane_ops *dp_ops,
> +                             void *ctx)
> +{
> +     struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev 
> *)netdev_priv(netdev);
> +
> +     BUG_ON(!gmacdev);
> +
> +     if (!dp_ops->open || !dp_ops->close || !dp_ops->link_state
> +             || !dp_ops->mac_addr || !dp_ops->change_mtu || !dp_ops->xmit) {
> +             netdev_dbg(netdev, "%s: All the op functions must be present, 
> reject this registeration",
> +                                                             __func__);
> +             return NSS_GMAC_FAILURE;
> +     }
> +
> +     /*
> +      * If this gmac is up, close the netdev to force TX/RX stop
> +      */
> +     if (test_bit(__NSS_GMAC_UP, &gmacdev->flags))
> +             nss_gmac_linux_close(netdev);
> +
> +     /* Recored the data_plane_ctx, data_plane_ops */
> +     gmacdev->data_plane_ctx = ctx;
> +     gmacdev->data_plane_ops = dp_ops;
> +     gmacdev->first_linkup_done = 0;
> +
> +     return NSS_GMAC_SUCCESS;
> +}
> +EXPORT_SYMBOL(nss_gmac_override_data_plane);

Why is this hook needed ?

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to