History

xfrm: rename xfrm_state_offload struct to allow reuse

The struct xfrm_state_offload has all fields needed to hold information for offloaded policies too. In order to do not create new struct with same fields, let's rename existing one and reuse it later.

Leon Romanovsky committed 4 years ago

Commit 87e0a941 parent a36708e4 files · +9 −9Browse files

Unified · Split

4 files
  1. include/net/xfrm.h +5 −5
  2. net/xfrm/xfrm_device.c +1 −1
  3. net/xfrm/xfrm_state.c +2 −2
  4. net/xfrm/xfrm_user.c +1 −1
include/net/xfrm.h+5−5
@@ -126,7 +126,7 @@ struct xfrm_state_walk { · 125 unmodified lines
126 struct xfrm_address_filter *filter;126 struct xfrm_address_filter *filter;
127};127};
128 128
129struct xfrm_state_offload {129struct xfrm_dev_offload {
130 struct net_device *dev;130 struct net_device *dev;
131 netdevice_tracker dev_tracker;131 netdevice_tracker dev_tracker;
132 struct net_device *real_dev;132 struct net_device *real_dev;
@@ -246,7 +246,7 @@ struct xfrm_state { · 113 unmodified lines
246 struct xfrm_lifetime_cur curlft;246 struct xfrm_lifetime_cur curlft;
247 struct hrtimer mtimer;247 struct hrtimer mtimer;
248 248
249 struct xfrm_state_offload xso;249 struct xfrm_dev_offload xso;
250 250
251 /* used to fix curlft->add_time when changing date */251 /* used to fix curlft->add_time when changing date */
252 long saved_tmo;252 long saved_tmo;
@@ -1865,7 +1865,7 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x); · 1612 unmodified lines
1865 1865
1866static inline void xfrm_dev_state_advance_esn(struct xfrm_state *x)1866static inline void xfrm_dev_state_advance_esn(struct xfrm_state *x)
1867{1867{
1868 struct xfrm_state_offload *xso = &x->xso;1868 struct xfrm_dev_offload *xso = &x->xso;
1869 1869
1870 if (xso->dev && xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn)1870 if (xso->dev && xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn)
1871 xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn(x);1871 xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn(x);
@@ -1891,7 +1891,7 @@ static inline bool xfrm_dst_offload_ok(struct dst_entry *dst) · 19 unmodified lines
1891 1891
1892static inline void xfrm_dev_state_delete(struct xfrm_state *x)1892static inline void xfrm_dev_state_delete(struct xfrm_state *x)
1893{1893{
1894 struct xfrm_state_offload *xso = &x->xso;1894 struct xfrm_dev_offload *xso = &x->xso;
1895 1895
1896 if (xso->dev)1896 if (xso->dev)
1897 xso->dev->xfrmdev_ops->xdo_dev_state_delete(x);1897 xso->dev->xfrmdev_ops->xdo_dev_state_delete(x);
@@ -1899,7 +1899,7 @@ static inline void xfrm_dev_state_delete(struct xfrm_state *x) · 1 unmodified line
1899 1899
1900static inline void xfrm_dev_state_free(struct xfrm_state *x)1900static inline void xfrm_dev_state_free(struct xfrm_state *x)
1901{1901{
1902 struct xfrm_state_offload *xso = &x->xso;1902 struct xfrm_dev_offload *xso = &x->xso;
1903 struct net_device *dev = xso->dev;1903 struct net_device *dev = xso->dev;
1904 1904
1905 if (dev && dev->xfrmdev_ops) {1905 if (dev && dev->xfrmdev_ops) {
net/xfrm/xfrm_device.c+1−1
@@ -212,7 +212,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, · 211 unmodified lines
212 int err;212 int err;
213 struct dst_entry *dst;213 struct dst_entry *dst;
214 struct net_device *dev;214 struct net_device *dev;
215 struct xfrm_state_offload *xso = &x->xso;215 struct xfrm_dev_offload *xso = &x->xso;
216 xfrm_address_t *saddr;216 xfrm_address_t *saddr;
217 xfrm_address_t *daddr;217 xfrm_address_t *daddr;
218 218
net/xfrm/xfrm_state.c+2−2
@@ -751,7 +751,7 @@ xfrm_dev_state_flush_secctx_check(struct net *net, struct net_device *dev, bool · 750 unmodified lines
751 751
752 for (i = 0; i <= net->xfrm.state_hmask; i++) {752 for (i = 0; i <= net->xfrm.state_hmask; i++) {
753 struct xfrm_state *x;753 struct xfrm_state *x;
754 struct xfrm_state_offload *xso;754 struct xfrm_dev_offload *xso;
755 755
756 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {756 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
757 xso = &x->xso;757 xso = &x->xso;
@@ -835,7 +835,7 @@ int xfrm_dev_state_flush(struct net *net, struct net_device *dev, bool task_vali · 77 unmodified lines
835 err = -ESRCH;835 err = -ESRCH;
836 for (i = 0; i <= net->xfrm.state_hmask; i++) {836 for (i = 0; i <= net->xfrm.state_hmask; i++) {
837 struct xfrm_state *x;837 struct xfrm_state *x;
838 struct xfrm_state_offload *xso;838 struct xfrm_dev_offload *xso;
839restart:839restart:
840 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {840 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
841 xso = &x->xso;841 xso = &x->xso;
net/xfrm/xfrm_user.c+1−1
@@ -840,7 +840,7 @@ static int copy_sec_ctx(struct xfrm_sec_ctx *s, struct sk_buff *skb) · 839 unmodified lines
840 return 0;840 return 0;
841}841}
842 842
843static int copy_user_offload(struct xfrm_state_offload *xso, struct sk_buff *skb)843static int copy_user_offload(struct xfrm_dev_offload *xso, struct sk_buff *skb)
844{844{
845 struct xfrm_user_offload *xuo;845 struct xfrm_user_offload *xuo;
846 struct nlattr *attr;846 struct nlattr *attr;

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