Message ID | 20230104194132.24637-4-gerhard@engleder-embedded.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tsnep: XDP support | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next, async |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 48 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
From: Gerhard Engleder <gerhard@engleder-embedded.com> Date: Wed Jan 04 2023 20:41:26 GMT+0100 > Add adapter state with flag for down state. This flag will be used by > the XDP TX path to deny TX if adapter is down. > > Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> > --- > drivers/net/ethernet/engleder/tsnep.h | 1 + > drivers/net/ethernet/engleder/tsnep_main.c | 11 +++++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/drivers/net/ethernet/engleder/tsnep.h b/drivers/net/ethernet/engleder/tsnep.h > index f93ba48bac3f..f72c0c4da1a9 100644 > --- a/drivers/net/ethernet/engleder/tsnep.h > +++ b/drivers/net/ethernet/engleder/tsnep.h > @@ -148,6 +148,7 @@ struct tsnep_adapter { > phy_interface_t phy_mode; > struct phy_device *phydev; > int msg_enable; > + unsigned long state; Now there will be a 4-byte hole in between ::msg_enable and ::state, maybe add ::state right after ::phydev? > > struct platform_device *pdev; > struct device *dmadev; > diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c > index 0d40728dcfca..56c8cae6251e 100644 > --- a/drivers/net/ethernet/engleder/tsnep_main.c > +++ b/drivers/net/ethernet/engleder/tsnep_main.c > @@ -43,6 +43,10 @@ > #define TSNEP_COALESCE_USECS_MAX ((ECM_INT_DELAY_MASK >> ECM_INT_DELAY_SHIFT) * \ > ECM_INT_DELAY_BASE_US + ECM_INT_DELAY_BASE_US - 1) > > +enum { > + __TSNEP_DOWN, > +}; > + > static void tsnep_enable_irq(struct tsnep_adapter *adapter, u32 mask) > { > iowrite32(mask, adapter->addr + ECM_INT_ENABLE); > @@ -1138,6 +1142,8 @@ static int tsnep_netdev_open(struct net_device *netdev) > tsnep_enable_irq(adapter, adapter->queue[i].irq_mask); > } > > + clear_bit(__TSNEP_DOWN, &adapter->state); > + > return 0; > > phy_failed: > @@ -1160,6 +1166,8 @@ static int tsnep_netdev_close(struct net_device *netdev) > struct tsnep_adapter *adapter = netdev_priv(netdev); > int i; > > + set_bit(__TSNEP_DOWN, &adapter->state); > + > tsnep_disable_irq(adapter, ECM_INT_LINK); > tsnep_phy_close(adapter); > > @@ -1513,6 +1521,7 @@ static int tsnep_probe(struct platform_device *pdev) > adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | > NETIF_MSG_LINK | NETIF_MSG_IFUP | > NETIF_MSG_IFDOWN | NETIF_MSG_TX_QUEUED; > + set_bit(__TSNEP_DOWN, &adapter->state); > > netdev->min_mtu = ETH_MIN_MTU; > netdev->max_mtu = TSNEP_MAX_FRAME_SIZE; > @@ -1609,6 +1618,8 @@ static int tsnep_remove(struct platform_device *pdev) > { > struct tsnep_adapter *adapter = platform_get_drvdata(pdev); > > + set_bit(__TSNEP_DOWN, &adapter->state); > + > unregister_netdev(adapter->netdev); > > tsnep_rxnfc_cleanup(adapter); Thanks, Olek
On 05.01.23 13:44, Alexander Lobakin wrote: > From: Gerhard Engleder <gerhard@engleder-embedded.com> > Date: Wed Jan 04 2023 20:41:26 GMT+0100 > >> Add adapter state with flag for down state. This flag will be used by >> the XDP TX path to deny TX if adapter is down. >> >> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> >> --- >> drivers/net/ethernet/engleder/tsnep.h | 1 + >> drivers/net/ethernet/engleder/tsnep_main.c | 11 +++++++++++ >> 2 files changed, 12 insertions(+) >> >> diff --git a/drivers/net/ethernet/engleder/tsnep.h b/drivers/net/ethernet/engleder/tsnep.h >> index f93ba48bac3f..f72c0c4da1a9 100644 >> --- a/drivers/net/ethernet/engleder/tsnep.h >> +++ b/drivers/net/ethernet/engleder/tsnep.h >> @@ -148,6 +148,7 @@ struct tsnep_adapter { >> phy_interface_t phy_mode; >> struct phy_device *phydev; >> int msg_enable; >> + unsigned long state; > > Now there will be a 4-byte hole in between ::msg_enable and ::state, > maybe add ::state right after ::phydev? I will do that. Gerhard
diff --git a/drivers/net/ethernet/engleder/tsnep.h b/drivers/net/ethernet/engleder/tsnep.h index f93ba48bac3f..f72c0c4da1a9 100644 --- a/drivers/net/ethernet/engleder/tsnep.h +++ b/drivers/net/ethernet/engleder/tsnep.h @@ -148,6 +148,7 @@ struct tsnep_adapter { phy_interface_t phy_mode; struct phy_device *phydev; int msg_enable; + unsigned long state; struct platform_device *pdev; struct device *dmadev; diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c index 0d40728dcfca..56c8cae6251e 100644 --- a/drivers/net/ethernet/engleder/tsnep_main.c +++ b/drivers/net/ethernet/engleder/tsnep_main.c @@ -43,6 +43,10 @@ #define TSNEP_COALESCE_USECS_MAX ((ECM_INT_DELAY_MASK >> ECM_INT_DELAY_SHIFT) * \ ECM_INT_DELAY_BASE_US + ECM_INT_DELAY_BASE_US - 1) +enum { + __TSNEP_DOWN, +}; + static void tsnep_enable_irq(struct tsnep_adapter *adapter, u32 mask) { iowrite32(mask, adapter->addr + ECM_INT_ENABLE); @@ -1138,6 +1142,8 @@ static int tsnep_netdev_open(struct net_device *netdev) tsnep_enable_irq(adapter, adapter->queue[i].irq_mask); } + clear_bit(__TSNEP_DOWN, &adapter->state); + return 0; phy_failed: @@ -1160,6 +1166,8 @@ static int tsnep_netdev_close(struct net_device *netdev) struct tsnep_adapter *adapter = netdev_priv(netdev); int i; + set_bit(__TSNEP_DOWN, &adapter->state); + tsnep_disable_irq(adapter, ECM_INT_LINK); tsnep_phy_close(adapter); @@ -1513,6 +1521,7 @@ static int tsnep_probe(struct platform_device *pdev) adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN | NETIF_MSG_TX_QUEUED; + set_bit(__TSNEP_DOWN, &adapter->state); netdev->min_mtu = ETH_MIN_MTU; netdev->max_mtu = TSNEP_MAX_FRAME_SIZE; @@ -1609,6 +1618,8 @@ static int tsnep_remove(struct platform_device *pdev) { struct tsnep_adapter *adapter = platform_get_drvdata(pdev); + set_bit(__TSNEP_DOWN, &adapter->state); + unregister_netdev(adapter->netdev); tsnep_rxnfc_cleanup(adapter);
Add adapter state with flag for down state. This flag will be used by the XDP TX path to deny TX if adapter is down. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> --- drivers/net/ethernet/engleder/tsnep.h | 1 + drivers/net/ethernet/engleder/tsnep_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+)