@@ -1202,6 +1202,7 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
1202
1202
const struct ethtool_ops * ops = dev -> ethtool_ops ;
1203
1203
struct ethtool_rxfh_param rxfh_dev = {};
1204
1204
u32 user_indir_size , user_key_size ;
1205
+ struct ethtool_rxfh_context * ctx ;
1205
1206
struct ethtool_rxfh rxfh ;
1206
1207
u32 indir_bytes ;
1207
1208
u8 * rss_config ;
@@ -1249,11 +1250,26 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
1249
1250
if (user_key_size )
1250
1251
rxfh_dev .key = rss_config + indir_bytes ;
1251
1252
1252
- rxfh_dev .rss_context = rxfh .rss_context ;
1253
-
1254
- ret = dev -> ethtool_ops -> get_rxfh (dev , & rxfh_dev );
1255
- if (ret )
1256
- goto out ;
1253
+ if (rxfh .rss_context ) {
1254
+ ctx = xa_load (& dev -> ethtool -> rss_ctx , rxfh .rss_context );
1255
+ if (!ctx ) {
1256
+ ret = - ENOENT ;
1257
+ goto out ;
1258
+ }
1259
+ if (rxfh_dev .indir )
1260
+ memcpy (rxfh_dev .indir , ethtool_rxfh_context_indir (ctx ),
1261
+ indir_bytes );
1262
+ if (rxfh_dev .key )
1263
+ memcpy (rxfh_dev .key , ethtool_rxfh_context_key (ctx ),
1264
+ user_key_size );
1265
+ rxfh_dev .hfunc = ctx -> hfunc ;
1266
+ rxfh_dev .input_xfrm = ctx -> input_xfrm ;
1267
+ ret = 0 ;
1268
+ } else {
1269
+ ret = dev -> ethtool_ops -> get_rxfh (dev , & rxfh_dev );
1270
+ if (ret )
1271
+ goto out ;
1272
+ }
1257
1273
1258
1274
if (copy_to_user (useraddr + offsetof(struct ethtool_rxfh , hfunc ),
1259
1275
& rxfh_dev .hfunc , sizeof (rxfh .hfunc ))) {
0 commit comments