|
@@ -1101,8 +1101,12 @@ struct proto {
|
|
|
*/
|
|
|
unsigned long *memory_pressure;
|
|
|
long *sysctl_mem;
|
|
|
+
|
|
|
int *sysctl_wmem;
|
|
|
int *sysctl_rmem;
|
|
|
+ u32 sysctl_wmem_offset;
|
|
|
+ u32 sysctl_rmem_offset;
|
|
|
+
|
|
|
int max_header;
|
|
|
bool no_autobind;
|
|
|
|
|
@@ -2390,4 +2394,22 @@ extern int sysctl_optmem_max;
|
|
|
extern __u32 sysctl_wmem_default;
|
|
|
extern __u32 sysctl_rmem_default;
|
|
|
|
|
|
+static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto)
|
|
|
+{
|
|
|
+ /* Does this proto have per netns sysctl_wmem ? */
|
|
|
+ if (proto->sysctl_wmem_offset)
|
|
|
+ return *(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset);
|
|
|
+
|
|
|
+ return *proto->sysctl_wmem;
|
|
|
+}
|
|
|
+
|
|
|
+static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
|
|
|
+{
|
|
|
+ /* Does this proto have per netns sysctl_rmem ? */
|
|
|
+ if (proto->sysctl_rmem_offset)
|
|
|
+ return *(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset);
|
|
|
+
|
|
|
+ return *proto->sysctl_rmem;
|
|
|
+}
|
|
|
+
|
|
|
#endif /* _SOCK_H */
|