@@ -1014,8 +1014,8 @@ struct ravb_hw_info {
void (*emac_init)(struct net_device *ndev);
const char (*gstrings_stats)[ETH_GSTRING_LEN];
size_t gstrings_size;
- netdev_features_t net_hw_features;
- netdev_features_t net_features;
+ const netdev_features_t *net_hw_features;
+ const netdev_features_t *net_features;
int stats_len;
size_t max_rx_len;
u32 tccr_mask;
@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/net_tstamp.h>
#include <linux/of.h>
#include <linux/of_device.h>
@@ -50,6 +51,9 @@ static const char *ravb_tx_irqs[NUM_TX_QUEUE] = {
"ch19", /* RAVB_NC */
};
+static netdev_features_t ravb_default_features;
+static netdev_features_t ravb_empty_features;
+
void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 clear,
u32 set)
{
@@ -2422,8 +2426,8 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
.emac_init = ravb_emac_init_rcar,
.gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats),
- .net_hw_features = NETIF_F_RXCSUM,
- .net_features = NETIF_F_RXCSUM,
+ .net_hw_features = &ravb_default_features,
+ .net_features = &ravb_default_features,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
@@ -2448,8 +2452,8 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
.emac_init = ravb_emac_init_rcar,
.gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats),
- .net_hw_features = NETIF_F_RXCSUM,
- .net_features = NETIF_F_RXCSUM,
+ .net_hw_features = &ravb_default_features,
+ .net_features = &ravb_default_features,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
@@ -2471,8 +2475,8 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {
.emac_init = ravb_emac_init_rcar,
.gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats),
- .net_hw_features = NETIF_F_RXCSUM,
- .net_features = NETIF_F_RXCSUM,
+ .net_hw_features = &ravb_default_features,
+ .net_features = &ravb_default_features,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
@@ -2496,6 +2500,8 @@ static const struct ravb_hw_info gbeth_hw_info = {
.emac_init = ravb_emac_init_gbeth,
.gstrings_stats = ravb_gstrings_stats_gbeth,
.gstrings_size = sizeof(ravb_gstrings_stats_gbeth),
+ .net_hw_features = &ravb_empty_features,
+ .net_features = &ravb_empty_features,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth),
.max_rx_len = ALIGN(GBETH_RX_BUFF_MAX, RAVB_ALIGN),
.tccr_mask = TCCR_TSRQ0,
@@ -2639,8 +2645,9 @@ static int ravb_probe(struct platform_device *pdev)
info = of_device_get_match_data(&pdev->dev);
- ndev->features = info->net_features;
- ndev->hw_features = info->net_hw_features;
+ netdev_feature_add(NETIF_F_RXCSUM_BIT, ravb_default_features);
+ ndev->features = *info->net_features;
+ ndev->hw_features = *info->net_hw_features;
reset_control_deassert(rstc);
pm_runtime_enable(&pdev->dev);
The ravb driver use netdev features in global structure initialization. Changed the netdev_features_t memeber to netdev_features_t *, and make it refer to a global constant netdev_features_t variable. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/renesas/ravb.h | 4 ++-- drivers/net/ethernet/renesas/ravb_main.c | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-)