Message ID | 20190425165637.7924-4-jakub.kicinski@netronome.com |
---|---|
State | Superseded |
Delegated to: | David Miller |
Headers | show |
Series | net/tls: small code cleanup | expand |
On Thu, 2019-04-25 at 09:56 -0700, Jakub Kicinski wrote: > There seems to be no reason for tls_ops to be defined in netdevice.h > which is included in a lot of places. Don't wrap the struct/enum > declaration in ifdefs, it trickles down unnecessary ifdefs into > driver code. > > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> > Reviewed-by: Reviewed-by: Simon Horman <simon.horman@netronome.com> > you need to fixup the above tag in all patches LGTM > --- > include/linux/netdevice.h | 23 +---------------------- > include/net/tls.h | 17 +++++++++++++++++ > 2 files changed, 18 insertions(+), 22 deletions(-) > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index c46d218a0456..44b47e9df94a 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -914,34 +914,13 @@ struct xfrmdev_ops { > }; > #endif > > -#if IS_ENABLED(CONFIG_TLS_DEVICE) > -enum tls_offload_ctx_dir { > - TLS_OFFLOAD_CTX_DIR_RX, > - TLS_OFFLOAD_CTX_DIR_TX, > -}; > - > -struct tls_crypto_info; > -struct tls_context; > - > -struct tlsdev_ops { > - int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, > - enum tls_offload_ctx_dir direction, > - struct tls_crypto_info *crypto_info, > - u32 start_offload_tcp_sn); > - void (*tls_dev_del)(struct net_device *netdev, > - struct tls_context *ctx, > - enum tls_offload_ctx_dir direction); > - void (*tls_dev_resync_rx)(struct net_device *netdev, > - struct sock *sk, u32 seq, u64 > rcd_sn); > -}; > -#endif > - > struct dev_ifalias { > struct rcu_head rcuhead; > char ifalias[]; > }; > > struct devlink; > +struct tlsdev_ops; > > /* > * This structure defines the management hooks for network devices. > diff --git a/include/net/tls.h b/include/net/tls.h > index 20196cb31ecc..41a2ee643fc5 100644 > --- a/include/net/tls.h > +++ b/include/net/tls.h > @@ -277,6 +277,23 @@ struct tls_context { > void (*unhash)(struct sock *sk); > }; > > +enum tls_offload_ctx_dir { > + TLS_OFFLOAD_CTX_DIR_RX, > + TLS_OFFLOAD_CTX_DIR_TX, > +}; > + > +struct tlsdev_ops { > + int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, > + enum tls_offload_ctx_dir direction, > + struct tls_crypto_info *crypto_info, > + u32 start_offload_tcp_sn); > + void (*tls_dev_del)(struct net_device *netdev, > + struct tls_context *ctx, > + enum tls_offload_ctx_dir direction); > + void (*tls_dev_resync_rx)(struct net_device *netdev, > + struct sock *sk, u32 seq, u64 > rcd_sn); > +}; > + > struct tls_offload_context_rx { > /* sw must be the first member of tls_offload_context_rx */ > struct tls_sw_context_rx sw;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c46d218a0456..44b47e9df94a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -914,34 +914,13 @@ struct xfrmdev_ops { }; #endif -#if IS_ENABLED(CONFIG_TLS_DEVICE) -enum tls_offload_ctx_dir { - TLS_OFFLOAD_CTX_DIR_RX, - TLS_OFFLOAD_CTX_DIR_TX, -}; - -struct tls_crypto_info; -struct tls_context; - -struct tlsdev_ops { - int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, - enum tls_offload_ctx_dir direction, - struct tls_crypto_info *crypto_info, - u32 start_offload_tcp_sn); - void (*tls_dev_del)(struct net_device *netdev, - struct tls_context *ctx, - enum tls_offload_ctx_dir direction); - void (*tls_dev_resync_rx)(struct net_device *netdev, - struct sock *sk, u32 seq, u64 rcd_sn); -}; -#endif - struct dev_ifalias { struct rcu_head rcuhead; char ifalias[]; }; struct devlink; +struct tlsdev_ops; /* * This structure defines the management hooks for network devices. diff --git a/include/net/tls.h b/include/net/tls.h index 20196cb31ecc..41a2ee643fc5 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -277,6 +277,23 @@ struct tls_context { void (*unhash)(struct sock *sk); }; +enum tls_offload_ctx_dir { + TLS_OFFLOAD_CTX_DIR_RX, + TLS_OFFLOAD_CTX_DIR_TX, +}; + +struct tlsdev_ops { + int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, + enum tls_offload_ctx_dir direction, + struct tls_crypto_info *crypto_info, + u32 start_offload_tcp_sn); + void (*tls_dev_del)(struct net_device *netdev, + struct tls_context *ctx, + enum tls_offload_ctx_dir direction); + void (*tls_dev_resync_rx)(struct net_device *netdev, + struct sock *sk, u32 seq, u64 rcd_sn); +}; + struct tls_offload_context_rx { /* sw must be the first member of tls_offload_context_rx */ struct tls_sw_context_rx sw;