dsa: Add boilerplate helper to register DSA tag driver modules
A DSA tag driver module will need to register the tag protocols it implements with the DSA core. Add macros containing this boiler plate. The registration/unregistration code is currently just a stub. A Later patch will add the real implementation. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> v2 Fix indent of #endif Rewrite to move list pointer into a new structure v3 Move kdoc next to macro Fix THIS_MODULE indentation Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
056eed2fb0
commit
d3b8c04988
@@ -76,6 +76,18 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
|
||||
[DSA_TAG_PROTO_NONE] = &none_ops,
|
||||
};
|
||||
|
||||
void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],
|
||||
unsigned int count, struct module *owner)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_tag_drivers_register);
|
||||
|
||||
void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[],
|
||||
unsigned int count)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_tag_drivers_unregister);
|
||||
|
||||
const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
|
||||
{
|
||||
return ops->name;
|
||||
|
@@ -175,6 +175,7 @@ const struct dsa_device_ops brcm_netdev_ops = {
|
||||
.overhead = BRCM_TAG_LEN,
|
||||
};
|
||||
|
||||
DSA_TAG_DRIVER(brcm_netdev_ops);
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM);
|
||||
#endif
|
||||
|
||||
@@ -203,5 +204,18 @@ const struct dsa_device_ops brcm_prepend_netdev_ops = {
|
||||
};
|
||||
#endif
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
DSA_TAG_DRIVER(brcm_prepend_netdev_ops);
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_PREPEND);
|
||||
|
||||
static struct dsa_tag_driver *dsa_tag_driver_array[] = {
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM)
|
||||
&DSA_TAG_DRIVER_NAME(brcm_netdev_ops),
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
|
||||
&DSA_TAG_DRIVER_NAME(brcm_prepend_netdev_ops),
|
||||
#endif
|
||||
};
|
||||
|
||||
module_dsa_tag_drivers(dsa_tag_driver_array);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -161,3 +161,5 @@ const struct dsa_device_ops dsa_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_DSA);
|
||||
|
||||
module_dsa_tag_driver(dsa_netdev_ops);
|
||||
|
@@ -180,3 +180,5 @@ const struct dsa_device_ops edsa_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_EDSA);
|
||||
|
||||
module_dsa_tag_driver(edsa_netdev_ops);
|
||||
|
@@ -113,3 +113,5 @@ const struct dsa_device_ops gswip_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_GSWIP);
|
||||
|
||||
module_dsa_tag_driver(gswip_netdev_ops);
|
||||
|
@@ -141,6 +141,7 @@ const struct dsa_device_ops ksz9477_netdev_ops = {
|
||||
.overhead = KSZ9477_INGRESS_TAG_LEN,
|
||||
};
|
||||
|
||||
DSA_TAG_DRIVER(ksz9477_netdev_ops);
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477);
|
||||
|
||||
#define KSZ9893_TAIL_TAG_OVERRIDE BIT(5)
|
||||
@@ -178,5 +179,14 @@ const struct dsa_device_ops ksz9893_netdev_ops = {
|
||||
.overhead = KSZ_INGRESS_TAG_LEN,
|
||||
};
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
DSA_TAG_DRIVER(ksz9893_netdev_ops);
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893);
|
||||
|
||||
static struct dsa_tag_driver *dsa_tag_driver_array[] = {
|
||||
&DSA_TAG_DRIVER_NAME(ksz9477_netdev_ops),
|
||||
&DSA_TAG_DRIVER_NAME(ksz9893_netdev_ops),
|
||||
};
|
||||
|
||||
module_dsa_tag_drivers(dsa_tag_driver_array);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -138,3 +138,5 @@ const struct dsa_device_ops lan9303_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN9303);
|
||||
|
||||
module_dsa_tag_driver(lan9303_netdev_ops);
|
||||
|
@@ -109,3 +109,5 @@ const struct dsa_device_ops mtk_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MTK);
|
||||
|
||||
module_dsa_tag_driver(mtk_netdev_ops);
|
||||
|
@@ -110,3 +110,5 @@ const struct dsa_device_ops qca_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_QCA);
|
||||
|
||||
module_dsa_tag_driver(qca_netdev_ops);
|
||||
|
@@ -87,3 +87,5 @@ const struct dsa_device_ops trailer_netdev_ops = {
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_TRAILER);
|
||||
|
||||
module_dsa_tag_driver(trailer_netdev_ops);
|
||||
|
Reference in New Issue
Block a user