Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'mlx5-ipsec-fixes'

Leon Romanovsky says:

====================
Fixes to mlx5 IPsec implementation

This small patchset includes various fixes and one refactoring patch
which I collected for the features sent in this cycle, with one exception -
first patch.

First patch fixes code which was introduced in previous cycle, however I
was able to trigger FW error only in custom debug code, so don't see a
need to send it to net-rc.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+35 -36
+26 -27
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
··· 252 252 struct net_device *netdev; 253 253 struct neighbour *n; 254 254 u8 addr[ETH_ALEN]; 255 + const void *pkey; 256 + u8 *dst, *src; 255 257 256 258 if (attrs->mode != XFRM_MODE_TUNNEL || 257 259 attrs->type != XFRM_DEV_OFFLOAD_PACKET) ··· 264 262 mlx5_query_mac_address(mdev, addr); 265 263 switch (attrs->dir) { 266 264 case XFRM_DEV_OFFLOAD_IN: 267 - ether_addr_copy(attrs->dmac, addr); 268 - n = neigh_lookup(&arp_tbl, &attrs->saddr.a4, netdev); 269 - if (!n) { 270 - n = neigh_create(&arp_tbl, &attrs->saddr.a4, netdev); 271 - if (IS_ERR(n)) 272 - return; 273 - neigh_event_send(n, NULL); 274 - attrs->drop = true; 275 - break; 276 - } 277 - neigh_ha_snapshot(addr, n, netdev); 278 - ether_addr_copy(attrs->smac, addr); 265 + src = attrs->dmac; 266 + dst = attrs->smac; 267 + pkey = &attrs->saddr.a4; 279 268 break; 280 269 case XFRM_DEV_OFFLOAD_OUT: 281 - ether_addr_copy(attrs->smac, addr); 282 - n = neigh_lookup(&arp_tbl, &attrs->daddr.a4, netdev); 283 - if (!n) { 284 - n = neigh_create(&arp_tbl, &attrs->daddr.a4, netdev); 285 - if (IS_ERR(n)) 286 - return; 287 - neigh_event_send(n, NULL); 288 - attrs->drop = true; 289 - break; 290 - } 291 - neigh_ha_snapshot(addr, n, netdev); 292 - ether_addr_copy(attrs->dmac, addr); 270 + src = attrs->smac; 271 + dst = attrs->dmac; 272 + pkey = &attrs->daddr.a4; 293 273 break; 294 274 default: 295 275 return; 276 + } 277 + 278 + ether_addr_copy(src, addr); 279 + n = neigh_lookup(&arp_tbl, pkey, netdev); 280 + if (!n) { 281 + n = neigh_create(&arp_tbl, pkey, netdev); 282 + if (IS_ERR(n)) 283 + return; 284 + neigh_event_send(n, NULL); 285 + attrs->drop = true; 286 + } else { 287 + neigh_ha_snapshot(addr, n, netdev); 288 + ether_addr_copy(dst, addr); 296 289 } 297 290 neigh_release(n); 298 291 } ··· 705 708 release_dwork: 706 709 kfree(sa_entry->dwork); 707 710 release_work: 708 - kfree(sa_entry->work->data); 711 + if (sa_entry->work) 712 + kfree(sa_entry->work->data); 709 713 kfree(sa_entry->work); 710 714 err_xfrm: 711 715 kfree(sa_entry); 712 - NL_SET_ERR_MSG_MOD(extack, "Device failed to offload this policy"); 716 + NL_SET_ERR_MSG_WEAK_MOD(extack, "Device failed to offload this state"); 713 717 return err; 714 718 } 715 719 ··· 750 752 mlx5e_accel_ipsec_fs_del_rule(sa_entry); 751 753 mlx5_ipsec_free_sa_ctx(sa_entry); 752 754 kfree(sa_entry->dwork); 753 - kfree(sa_entry->work->data); 755 + if (sa_entry->work) 756 + kfree(sa_entry->work->data); 754 757 kfree(sa_entry->work); 755 758 sa_entry_free: 756 759 kfree(sa_entry);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
··· 287 287 { 288 288 static const __be32 zaddr6[4] = {}; 289 289 290 - return !memcmp(addr6, zaddr6, sizeof(*zaddr6)); 290 + return !memcmp(addr6, zaddr6, sizeof(zaddr6)); 291 291 } 292 292 #else 293 293 static inline void mlx5e_ipsec_init(struct mlx5e_priv *priv)
+8 -8
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
··· 1252 1252 setup_fte_no_frags(spec); 1253 1253 setup_fte_upper_proto_match(spec, &attrs->upspec); 1254 1254 1255 - if (attrs->reqid) { 1255 + switch (attrs->action) { 1256 + case XFRM_POLICY_ALLOW: 1257 + flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 1258 + if (!attrs->reqid) 1259 + break; 1260 + 1256 1261 err = setup_modify_header(mdev, attrs->reqid, 1257 1262 XFRM_DEV_OFFLOAD_OUT, &flow_act); 1258 1263 if (err) 1259 1264 goto err_mod_header; 1260 - } 1261 - 1262 - switch (attrs->action) { 1263 - case XFRM_POLICY_ALLOW: 1264 - flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 1265 1265 break; 1266 1266 case XFRM_POLICY_BLOCK: 1267 1267 flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP | ··· 1273 1273 default: 1274 1274 WARN_ON(true); 1275 1275 err = -EINVAL; 1276 - goto err_action; 1276 + goto err_mod_header; 1277 1277 } 1278 1278 1279 1279 flow_act.flags |= FLOW_ACT_NO_APPEND; ··· 1293 1293 return 0; 1294 1294 1295 1295 err_action: 1296 - if (attrs->reqid) 1296 + if (flow_act.modify_hdr) 1297 1297 mlx5_modify_header_dealloc(mdev, flow_act.modify_hdr); 1298 1298 err_mod_header: 1299 1299 kvfree(spec);