History

atm: nicstar: Replace in_interrupt() usage

push_scqe() uses in_interrupt() to figure out if it is allowed to sleep. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. Aside of that in_interrupt() is not correct as it does not catch preempt disabled regions which neither can sleep. ns_send() (the only caller of push_scqe()) has the following callers: - vcc_sendmsg() used as proto_ops::sendmsg is expected to be invoked in preemtible context. -> vcc->dev->ops->send() (ns_send()) - atm_vcc::send via atmdev_ops::send either directly (pointer copied by atm_init_aal34() or atm_init_aal5()) or via atm_send_aal0(). This is invoked by drivers (like br2684, clip, pppoatm, ...) which are called from net_device_ops::ndo_start_xmit with BH disabled. Add atmdev_ops::send_bh which is used by callers from BH context (atm_send_aal*()) and if this callback missing then ::send is used instead. Implement this callback in nicstar and use it to replace in_interrupt().

Sebastian Andrzej Siewior committed 5 years ago

Commit f2bcc2f1 parent 030946f3 files · +29 −8Browse files

Showing the changes to include/linux/atmdev.h (1 of 3 files). Show all

Unified · Split

include/linux/atmdev.h+1−0
@@ -186,6 +186,7 @@ struct atmdev_ops { /* only send is required */ · 185 unmodified lines
186186 void __user *arg);
187187 #endif
188188 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
189+ int (*send_bh)(struct atm_vcc *vcc, struct sk_buff *skb);
189190 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
190191 void (*phy_put)(struct atm_dev *dev,unsigned char value,
191192 unsigned long addr);