[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3747ac7a-2901-4d2c-8227-3e3bf34633ed@intel.com>
Date: Thu, 5 Jan 2023 13:44:22 +0100
From: Alexander Lobakin <alexandr.lobakin@...el.com>
To: Gerhard Engleder <gerhard@...leder-embedded.com>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3 3/9] tsnep: Add adapter down state
From: Gerhard Engleder <gerhard@...leder-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@...leder-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
Powered by blists - more mailing lists