Skip to content

Commit bd9424e

Browse files
Subbaraya Sundeepdavem330
authored andcommitted
macsec: Use helper macsec_netdev_priv for offload drivers
Now macsec on top of vlan can be offloaded to macsec offloading devices so that VLAN tag is sent in clear text on wire i.e, packet structure is DMAC|SMAC|VLAN|SECTAG. Offloading devices can simply enable NETIF_F_HW_MACSEC feature in netdev->vlan_features for this to work. But the logic in offloading drivers to retrieve the private structure from netdev needs to be changed to check whether the netdev received is real device or a vlan device and get private structure accordingly. This patch changes the offloading drivers to use helper macsec_netdev_priv instead of netdev_priv. Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2f0f556 commit bd9424e

File tree

4 files changed

+49
-48
lines changed

4 files changed

+49
-48
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_macsec.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static int aq_get_txsc_stats(struct aq_hw_s *hw, const int sc_idx,
289289

290290
static int aq_mdo_dev_open(struct macsec_context *ctx)
291291
{
292-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
292+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
293293
int ret = 0;
294294

295295
if (netif_carrier_ok(nic->ndev))
@@ -300,7 +300,7 @@ static int aq_mdo_dev_open(struct macsec_context *ctx)
300300

301301
static int aq_mdo_dev_stop(struct macsec_context *ctx)
302302
{
303-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
303+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
304304
int i;
305305

306306
for (i = 0; i < AQ_MACSEC_MAX_SC; i++) {
@@ -439,7 +439,7 @@ static enum aq_macsec_sc_sa sc_sa_from_num_an(const int num_an)
439439

440440
static int aq_mdo_add_secy(struct macsec_context *ctx)
441441
{
442-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
442+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
443443
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
444444
const struct macsec_secy *secy = ctx->secy;
445445
enum aq_macsec_sc_sa sc_sa;
@@ -474,7 +474,7 @@ static int aq_mdo_add_secy(struct macsec_context *ctx)
474474

475475
static int aq_mdo_upd_secy(struct macsec_context *ctx)
476476
{
477-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
477+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
478478
const struct macsec_secy *secy = ctx->secy;
479479
int txsc_idx;
480480
int ret = 0;
@@ -528,7 +528,7 @@ static int aq_clear_txsc(struct aq_nic_s *nic, const int txsc_idx,
528528

529529
static int aq_mdo_del_secy(struct macsec_context *ctx)
530530
{
531-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
531+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
532532
int ret = 0;
533533

534534
if (!nic->macsec_cfg)
@@ -576,7 +576,7 @@ static int aq_update_txsa(struct aq_nic_s *nic, const unsigned int sc_idx,
576576

577577
static int aq_mdo_add_txsa(struct macsec_context *ctx)
578578
{
579-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
579+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
580580
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
581581
const struct macsec_secy *secy = ctx->secy;
582582
struct aq_macsec_txsc *aq_txsc;
@@ -603,7 +603,7 @@ static int aq_mdo_add_txsa(struct macsec_context *ctx)
603603

604604
static int aq_mdo_upd_txsa(struct macsec_context *ctx)
605605
{
606-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
606+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
607607
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
608608
const struct macsec_secy *secy = ctx->secy;
609609
struct aq_macsec_txsc *aq_txsc;
@@ -652,7 +652,7 @@ static int aq_clear_txsa(struct aq_nic_s *nic, struct aq_macsec_txsc *aq_txsc,
652652

653653
static int aq_mdo_del_txsa(struct macsec_context *ctx)
654654
{
655-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
655+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
656656
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
657657
int txsc_idx;
658658
int ret = 0;
@@ -744,7 +744,7 @@ static int aq_set_rxsc(struct aq_nic_s *nic, const u32 rxsc_idx)
744744

745745
static int aq_mdo_add_rxsc(struct macsec_context *ctx)
746746
{
747-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
747+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
748748
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
749749
const u32 rxsc_idx_max = aq_sc_idx_max(cfg->sc_sa);
750750
u32 rxsc_idx;
@@ -775,7 +775,7 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx)
775775

776776
static int aq_mdo_upd_rxsc(struct macsec_context *ctx)
777777
{
778-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
778+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
779779
int rxsc_idx;
780780
int ret = 0;
781781

@@ -838,7 +838,7 @@ static int aq_clear_rxsc(struct aq_nic_s *nic, const int rxsc_idx,
838838

839839
static int aq_mdo_del_rxsc(struct macsec_context *ctx)
840840
{
841-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
841+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
842842
enum aq_clear_type clear_type = AQ_CLEAR_SW;
843843
int rxsc_idx;
844844
int ret = 0;
@@ -906,8 +906,8 @@ static int aq_update_rxsa(struct aq_nic_s *nic, const unsigned int sc_idx,
906906

907907
static int aq_mdo_add_rxsa(struct macsec_context *ctx)
908908
{
909+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
909910
const struct macsec_rx_sc *rx_sc = ctx->sa.rx_sa->sc;
910-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
911911
const struct macsec_secy *secy = ctx->secy;
912912
struct aq_macsec_rxsc *aq_rxsc;
913913
int rxsc_idx;
@@ -933,8 +933,8 @@ static int aq_mdo_add_rxsa(struct macsec_context *ctx)
933933

934934
static int aq_mdo_upd_rxsa(struct macsec_context *ctx)
935935
{
936+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
936937
const struct macsec_rx_sc *rx_sc = ctx->sa.rx_sa->sc;
937-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
938938
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
939939
const struct macsec_secy *secy = ctx->secy;
940940
int rxsc_idx;
@@ -982,8 +982,8 @@ static int aq_clear_rxsa(struct aq_nic_s *nic, struct aq_macsec_rxsc *aq_rxsc,
982982

983983
static int aq_mdo_del_rxsa(struct macsec_context *ctx)
984984
{
985+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
985986
const struct macsec_rx_sc *rx_sc = ctx->sa.rx_sa->sc;
986-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
987987
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
988988
int rxsc_idx;
989989
int ret = 0;
@@ -1000,7 +1000,7 @@ static int aq_mdo_del_rxsa(struct macsec_context *ctx)
10001000

10011001
static int aq_mdo_get_dev_stats(struct macsec_context *ctx)
10021002
{
1003-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
1003+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
10041004
struct aq_macsec_common_stats *stats = &nic->macsec_cfg->stats;
10051005
struct aq_hw_s *hw = nic->aq_hw;
10061006

@@ -1020,7 +1020,7 @@ static int aq_mdo_get_dev_stats(struct macsec_context *ctx)
10201020

10211021
static int aq_mdo_get_tx_sc_stats(struct macsec_context *ctx)
10221022
{
1023-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
1023+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
10241024
struct aq_macsec_tx_sc_stats *stats;
10251025
struct aq_hw_s *hw = nic->aq_hw;
10261026
struct aq_macsec_txsc *aq_txsc;
@@ -1044,7 +1044,7 @@ static int aq_mdo_get_tx_sc_stats(struct macsec_context *ctx)
10441044

10451045
static int aq_mdo_get_tx_sa_stats(struct macsec_context *ctx)
10461046
{
1047-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
1047+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
10481048
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
10491049
struct aq_macsec_tx_sa_stats *stats;
10501050
struct aq_hw_s *hw = nic->aq_hw;
@@ -1084,7 +1084,7 @@ static int aq_mdo_get_tx_sa_stats(struct macsec_context *ctx)
10841084

10851085
static int aq_mdo_get_rx_sc_stats(struct macsec_context *ctx)
10861086
{
1087-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
1087+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
10881088
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
10891089
struct aq_macsec_rx_sa_stats *stats;
10901090
struct aq_hw_s *hw = nic->aq_hw;
@@ -1129,7 +1129,7 @@ static int aq_mdo_get_rx_sc_stats(struct macsec_context *ctx)
11291129

11301130
static int aq_mdo_get_rx_sa_stats(struct macsec_context *ctx)
11311131
{
1132-
struct aq_nic_s *nic = netdev_priv(ctx->netdev);
1132+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev);
11331133
struct aq_macsec_cfg *cfg = nic->macsec_cfg;
11341134
struct aq_macsec_rx_sa_stats *stats;
11351135
struct aq_hw_s *hw = nic->aq_hw;
@@ -1399,7 +1399,7 @@ static void aq_check_txsa_expiration(struct aq_nic_s *nic)
13991399
#define AQ_LOCKED_MDO_DEF(mdo) \
14001400
static int aq_locked_mdo_##mdo(struct macsec_context *ctx) \
14011401
{ \
1402-
struct aq_nic_s *nic = netdev_priv(ctx->netdev); \
1402+
struct aq_nic_s *nic = macsec_netdev_priv(ctx->netdev); \
14031403
int ret; \
14041404
mutex_lock(&nic->macsec_mutex); \
14051405
ret = aq_mdo_##mdo(ctx); \

drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy
10531053

10541054
static int cn10k_mdo_open(struct macsec_context *ctx)
10551055
{
1056-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1056+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
10571057
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
10581058
struct macsec_secy *secy = ctx->secy;
10591059
struct macsec_tx_sa *sw_tx_sa;
@@ -1077,7 +1077,7 @@ static int cn10k_mdo_open(struct macsec_context *ctx)
10771077

10781078
static int cn10k_mdo_stop(struct macsec_context *ctx)
10791079
{
1080-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1080+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
10811081
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
10821082
struct cn10k_mcs_txsc *txsc;
10831083
int err;
@@ -1095,7 +1095,7 @@ static int cn10k_mdo_stop(struct macsec_context *ctx)
10951095

10961096
static int cn10k_mdo_add_secy(struct macsec_context *ctx)
10971097
{
1098-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1098+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
10991099
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
11001100
struct macsec_secy *secy = ctx->secy;
11011101
struct cn10k_mcs_txsc *txsc;
@@ -1129,7 +1129,7 @@ static int cn10k_mdo_add_secy(struct macsec_context *ctx)
11291129

11301130
static int cn10k_mdo_upd_secy(struct macsec_context *ctx)
11311131
{
1132-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1132+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
11331133
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
11341134
struct macsec_secy *secy = ctx->secy;
11351135
struct macsec_tx_sa *sw_tx_sa;
@@ -1164,7 +1164,7 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx)
11641164

11651165
static int cn10k_mdo_del_secy(struct macsec_context *ctx)
11661166
{
1167-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1167+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
11681168
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
11691169
struct cn10k_mcs_txsc *txsc;
11701170

@@ -1183,7 +1183,7 @@ static int cn10k_mdo_del_secy(struct macsec_context *ctx)
11831183

11841184
static int cn10k_mdo_add_txsa(struct macsec_context *ctx)
11851185
{
1186-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1186+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
11871187
struct macsec_tx_sa *sw_tx_sa = ctx->sa.tx_sa;
11881188
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
11891189
struct macsec_secy *secy = ctx->secy;
@@ -1225,7 +1225,7 @@ static int cn10k_mdo_add_txsa(struct macsec_context *ctx)
12251225

12261226
static int cn10k_mdo_upd_txsa(struct macsec_context *ctx)
12271227
{
1228-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1228+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
12291229
struct macsec_tx_sa *sw_tx_sa = ctx->sa.tx_sa;
12301230
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
12311231
struct macsec_secy *secy = ctx->secy;
@@ -1258,7 +1258,7 @@ static int cn10k_mdo_upd_txsa(struct macsec_context *ctx)
12581258

12591259
static int cn10k_mdo_del_txsa(struct macsec_context *ctx)
12601260
{
1261-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1261+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
12621262
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
12631263
u8 sa_num = ctx->sa.assoc_num;
12641264
struct cn10k_mcs_txsc *txsc;
@@ -1278,7 +1278,7 @@ static int cn10k_mdo_del_txsa(struct macsec_context *ctx)
12781278

12791279
static int cn10k_mdo_add_rxsc(struct macsec_context *ctx)
12801280
{
1281-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1281+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
12821282
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
12831283
struct macsec_secy *secy = ctx->secy;
12841284
struct cn10k_mcs_rxsc *rxsc;
@@ -1312,7 +1312,7 @@ static int cn10k_mdo_add_rxsc(struct macsec_context *ctx)
13121312

13131313
static int cn10k_mdo_upd_rxsc(struct macsec_context *ctx)
13141314
{
1315-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1315+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
13161316
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
13171317
struct macsec_secy *secy = ctx->secy;
13181318
bool enable = ctx->rx_sc->active;
@@ -1331,7 +1331,7 @@ static int cn10k_mdo_upd_rxsc(struct macsec_context *ctx)
13311331

13321332
static int cn10k_mdo_del_rxsc(struct macsec_context *ctx)
13331333
{
1334-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1334+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
13351335
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
13361336
struct cn10k_mcs_rxsc *rxsc;
13371337

@@ -1349,8 +1349,8 @@ static int cn10k_mdo_del_rxsc(struct macsec_context *ctx)
13491349

13501350
static int cn10k_mdo_add_rxsa(struct macsec_context *ctx)
13511351
{
1352+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
13521353
struct macsec_rx_sc *sw_rx_sc = ctx->sa.rx_sa->sc;
1353-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
13541354
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
13551355
struct macsec_rx_sa *rx_sa = ctx->sa.rx_sa;
13561356
u64 next_pn = rx_sa->next_pn_halves.lower;
@@ -1389,8 +1389,8 @@ static int cn10k_mdo_add_rxsa(struct macsec_context *ctx)
13891389

13901390
static int cn10k_mdo_upd_rxsa(struct macsec_context *ctx)
13911391
{
1392+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
13921393
struct macsec_rx_sc *sw_rx_sc = ctx->sa.rx_sa->sc;
1393-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
13941394
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
13951395
struct macsec_rx_sa *rx_sa = ctx->sa.rx_sa;
13961396
u64 next_pn = rx_sa->next_pn_halves.lower;
@@ -1422,8 +1422,8 @@ static int cn10k_mdo_upd_rxsa(struct macsec_context *ctx)
14221422

14231423
static int cn10k_mdo_del_rxsa(struct macsec_context *ctx)
14241424
{
1425+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
14251426
struct macsec_rx_sc *sw_rx_sc = ctx->sa.rx_sa->sc;
1426-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
14271427
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
14281428
u8 sa_num = ctx->sa.assoc_num;
14291429
struct cn10k_mcs_rxsc *rxsc;
@@ -1445,8 +1445,8 @@ static int cn10k_mdo_del_rxsa(struct macsec_context *ctx)
14451445

14461446
static int cn10k_mdo_get_dev_stats(struct macsec_context *ctx)
14471447
{
1448+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
14481449
struct mcs_secy_stats tx_rsp = { 0 }, rx_rsp = { 0 };
1449-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
14501450
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
14511451
struct macsec_secy *secy = ctx->secy;
14521452
struct cn10k_mcs_txsc *txsc;
@@ -1481,7 +1481,7 @@ static int cn10k_mdo_get_dev_stats(struct macsec_context *ctx)
14811481

14821482
static int cn10k_mdo_get_tx_sc_stats(struct macsec_context *ctx)
14831483
{
1484-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1484+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
14851485
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
14861486
struct mcs_sc_stats rsp = { 0 };
14871487
struct cn10k_mcs_txsc *txsc;
@@ -1502,7 +1502,7 @@ static int cn10k_mdo_get_tx_sc_stats(struct macsec_context *ctx)
15021502

15031503
static int cn10k_mdo_get_tx_sa_stats(struct macsec_context *ctx)
15041504
{
1505-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1505+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
15061506
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
15071507
struct mcs_sa_stats rsp = { 0 };
15081508
u8 sa_num = ctx->sa.assoc_num;
@@ -1525,7 +1525,7 @@ static int cn10k_mdo_get_tx_sa_stats(struct macsec_context *ctx)
15251525

15261526
static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx)
15271527
{
1528-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
1528+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
15291529
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
15301530
struct macsec_secy *secy = ctx->secy;
15311531
struct mcs_sc_stats rsp = { 0 };
@@ -1567,8 +1567,8 @@ static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx)
15671567

15681568
static int cn10k_mdo_get_rx_sa_stats(struct macsec_context *ctx)
15691569
{
1570+
struct otx2_nic *pfvf = macsec_netdev_priv(ctx->netdev);
15701571
struct macsec_rx_sc *sw_rx_sc = ctx->sa.rx_sa->sc;
1571-
struct otx2_nic *pfvf = netdev_priv(ctx->netdev);
15721572
struct cn10k_mcs_cfg *cfg = pfvf->macsec_cfg;
15731573
struct mcs_sa_stats rsp = { 0 };
15741574
u8 sa_num = ctx->sa.assoc_num;

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,6 @@ static void mlx5e_macsec_cleanup_sa(struct mlx5e_macsec *macsec,
349349
sa->macsec_rule = NULL;
350350
}
351351

352-
static struct mlx5e_priv *macsec_netdev_priv(const struct net_device *dev)
353-
{
354-
#if IS_ENABLED(CONFIG_VLAN_8021Q)
355-
if (is_vlan_dev(dev))
356-
return netdev_priv(vlan_dev_priv(dev)->real_dev);
357-
#endif
358-
return netdev_priv(dev);
359-
}
360-
361352
static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
362353
struct mlx5e_macsec_sa *sa,
363354
bool encrypt,

include/net/macsec.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define _NET_MACSEC_H_
99

1010
#include <linux/u64_stats_sync.h>
11+
#include <linux/if_vlan.h>
1112
#include <uapi/linux/if_link.h>
1213
#include <uapi/linux/if_macsec.h>
1314

@@ -312,4 +313,13 @@ static inline bool macsec_send_sci(const struct macsec_secy *secy)
312313
(secy->n_rx_sc > 1 && !tx_sc->end_station && !tx_sc->scb);
313314
}
314315

316+
static inline void *macsec_netdev_priv(const struct net_device *dev)
317+
{
318+
#if IS_ENABLED(CONFIG_VLAN_8021Q)
319+
if (is_vlan_dev(dev))
320+
return netdev_priv(vlan_dev_priv(dev)->real_dev);
321+
#endif
322+
return netdev_priv(dev);
323+
}
324+
315325
#endif /* _NET_MACSEC_H_ */

0 commit comments

Comments
 (0)