History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Daniel Borkmann says: ==================== pull-request: bpf-next 2019-07-03 The following pull-request contains BPF updates for your *net-next* tree. There is a minor merge conflict in mlx5 due to 8960b38932be ("linux/dim: Rename externally used net_dim members") which has been pulled into your tree in the meantime, but resolution seems not that bad ... getting current bpf-next out now before there's coming more on mlx5. ;) I'm Cc'ing Saeed just so he's aware of the resolution below: ** First conflict in drivers/net/ethernet/mellanox/mlx5/core/en_main.c: <<<<<<< HEAD static int mlx5e_open_cq(struct mlx5e_channel *c, struct dim_cq_moder moder, struct mlx5e_cq_param *param, struct mlx5e_cq *cq) ======= int mlx5e_open_cq(struct mlx5e_channel *c, struct net_dim_cq_moder moder, struct mlx5e_cq_param *param, struct mlx5e_cq *cq) >>>>>>> e5a3e259ef239f443951d401db10db7d426c9497 Resolution is to take the second chunk and rename net_dim_cq_moder into dim_cq_moder. Also the signature for mlx5e_open_cq() in ... drivers/net/ethernet/mellanox/mlx5/core/en.h +977 ... and in mlx5e_open_xsk() ... drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +64 ... needs the same rename from net_dim_cq_moder into dim_cq_moder. ** Second conflict in drivers/net/ethernet/mellanox/mlx5/core/en_main.c: <<<<<<< HEAD int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, ix)); struct dim_cq_moder icocq_moder = {0, 0}; struct net_device *netdev = priv->netdev; struct mlx5e_channel *c; unsigned int irq; ======= struct net_dim_cq_moder icocq_moder = {0, 0}; >>>>>>> e5a3e259ef239f443951d401db10db7d426c9497 Take the second chunk and rename net_dim_cq_moder into dim_cq_moder as well. Let me know if you run into any issues. Anyway, the main changes are: 1) Long-awaited AF_XDP support for mlx5e driver, from Maxim. 2) Addition of two new per-cgroup BPF hooks for getsockopt and setsockopt along with a new sockopt program type which allows more fine-grained pass/reject settings for containers. Also add a sock_ops callback that can be selectively enabled on a per-socket basis and is executed for every RTT to help tracking TCP statistics, both features from Stanislav. 3) Follow-up fix from loops in precision tracking which was not propagating precision marks and as a result verifier assumed that some branches were not taken and therefore wrongly removed as dead code, from Alexei. 4) Fix BPF cgroup release synchronization race which could lead to a double-free if a leaf's cgroup_bpf object is released and a new BPF program is attached to the one of ancestor cgroups in parallel, from Roman. 5) Support for bulking XDP_TX on veth devices which improves performance in some cases by around 9%, from Toshiaki. 6) Allow for lookups into BPF devmap and improve feedback when calling into bpf_redirect_map() as lookup is now performed right away in the helper itself, from Toke. 7) Add support for fq's Earliest Departure Time to the Host Bandwidth Manager (HBM) sample BPF program, from Lawrence. 8) Various cleanups and minor fixes all over the place from many others. ====================

David S. Miller committed 7 years ago

Commit c4cde582 parents e2c7469 e5a3e2598 files · +6197 −841Browse files

Showing the changes to include/linux (5 of 98 files). Show all

Unified · Split

5 files
  1. include/linux/bpf-cgroup.h +45 −0
  2. include/linux/bpf.h +2 −0
  3. include/linux/bpf_types.h +1 −0
  4. include/linux/filter.h +12 −1
  5. include/linux/list.h +14 −0
include/linux/bpf-cgroup.h+45−0
@@ -124,6 +124,14 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 123 unmodified lines
124124 loff_t *ppos, void **new_buf,
125125 enum bpf_attach_type type);
126126
127+int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level,
128+ int *optname, char __user *optval,
129+ int *optlen, char **kernel_optval);
130+int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
131+ int optname, char __user *optval,
132+ int __user *optlen, int max_optlen,
133+ int retval);
134+
127135 static inline enum bpf_cgroup_storage_type cgroup_storage_type(
128136 struct bpf_map *map)
129137 {
@@ -286,6 +294,38 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 156 unmodified lines
286294 __ret; \
287295 })
288296
297+#define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \
298+ kernel_optval) \
299+({ \
300+ int __ret = 0; \
301+ if (cgroup_bpf_enabled) \
302+ __ret = __cgroup_bpf_run_filter_setsockopt(sock, level, \
303+ optname, optval, \
304+ optlen, \
305+ kernel_optval); \
306+ __ret; \
307+})
308+
309+#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) \
310+({ \
311+ int __ret = 0; \
312+ if (cgroup_bpf_enabled) \
313+ get_user(__ret, optlen); \
314+ __ret; \
315+})
316+
317+#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, optlen, \
318+ max_optlen, retval) \
319+({ \
320+ int __ret = retval; \
321+ if (cgroup_bpf_enabled) \
322+ __ret = __cgroup_bpf_run_filter_getsockopt(sock, level, \
323+ optname, optval, \
324+ optlen, max_optlen, \
325+ retval); \
326+ __ret; \
327+})
328+
289329 int cgroup_bpf_prog_attach(const union bpf_attr *attr,
290330 enum bpf_prog_type ptype, struct bpf_prog *prog);
291331 int cgroup_bpf_prog_detach(const union bpf_attr *attr,
@@ -357,6 +397,11 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 65 unmodified lines
357397 #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
358398 #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })
359399 #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; })
400+#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; })
401+#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \
402+ optlen, max_optlen, retval) ({ retval; })
403+#define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \
404+ kernel_optval) ({ 0; })
360405
361406 #define for_each_cgroup_storage_type(stype) for (; false; )
362407
include/linux/bpf.h+2−0
@@ -518,6 +518,7 @@ struct bpf_prog_array { · 517 unmodified lines
518518 struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags);
519519 void bpf_prog_array_free(struct bpf_prog_array *progs);
520520 int bpf_prog_array_length(struct bpf_prog_array *progs);
521+bool bpf_prog_array_is_empty(struct bpf_prog_array *array);
521522 int bpf_prog_array_copy_to_user(struct bpf_prog_array *progs,
522523 __u32 __user *prog_ids, u32 cnt);
523524
@@ -1051,6 +1052,7 @@ extern const struct bpf_func_proto bpf_spin_unlock_proto; · 527 unmodified lines
10511052 extern const struct bpf_func_proto bpf_get_local_storage_proto;
10521053 extern const struct bpf_func_proto bpf_strtol_proto;
10531054 extern const struct bpf_func_proto bpf_strtoul_proto;
1055+extern const struct bpf_func_proto bpf_tcp_sock_proto;
10541056
10551057 /* Shared helpers among cBPF and eBPF. */
10561058 void bpf_user_rnd_init_once(void);
include/linux/bpf_types.h+1−0
@@ -30,6 +30,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) · 29 unmodified lines
3030 #ifdef CONFIG_CGROUP_BPF
3131 BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)
3232 BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl)
33+BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt)
3334 #endif
3435 #ifdef CONFIG_BPF_LIRC_MODE2
3536 BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2)
include/linux/filter.h+12−1
@@ -578,8 +578,9 @@ struct bpf_skb_data_end { · 577 unmodified lines
578578 };
579579
580580 struct bpf_redirect_info {
581− u32 ifindex;
582581 u32 flags;
582+ u32 tgt_index;
583+ void *tgt_value;
583584 struct bpf_map *map;
584585 struct bpf_map *map_to_flush;
585586 u32 kern_flags;
@@ -1199,4 +1200,14 @@ struct bpf_sysctl_kern { · 613 unmodified lines
11991200 u64 tmp_reg;
12001201 };
12011202
1203+struct bpf_sockopt_kern {
1204+ struct sock *sk;
1205+ u8 *optval;
1206+ u8 *optval_end;
1207+ s32 level;
1208+ s32 optname;
1209+ s32 optlen;
1210+ s32 retval;
1211+};
1212+
12021213 #endif /* __LINUX_FILTER_H__ */
include/linux/list.h+14−0
@@ -106,6 +106,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) · 105 unmodified lines
106106 WRITE_ONCE(prev->next, next);
107107 }
108108
109+/*
110+ * Delete a list entry and clear the 'prev' pointer.
111+ *
112+ * This is a special-purpose list clearing method used in the networking code
113+ * for lists allocated as per-cpu, where we don't want to incur the extra
114+ * WRITE_ONCE() overhead of a regular list_del_init(). The code that uses this
115+ * needs to check the node 'prev' pointer instead of calling list_empty().
116+ */
117+static inline void __list_del_clearprev(struct list_head *entry)
118+{
119+ __list_del(entry->prev, entry->next);
120+ entry->prev = NULL;
121+}
122+
109123 /**
110124 * list_del - deletes entry from list.
111125 * @entry: the element to delete from the list.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t