Skip to content

Commit f7f97cb

Browse files
jjagielskkuba-moo
authored andcommitted
ixgbe: handle IXGBE_VF_GET_PF_LINK_STATE mailbox operation
Update supported API version and provide handler for IXGBE_VF_GET_PF_LINK_STATE cmd. Simply put stored values of link speed and link_up from adapter context. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Link: https://lore.kernel.org/stable/20250828095227.1857066-3-jedrzej.jagielski%40intel.com Tested-by: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20251009-jk-iwl-net-2025-10-01-v3-3-ef32a425b92a@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 53f0eb6 commit f7f97cb

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ enum ixgbe_pfvf_api_rev {
5050
ixgbe_mbox_api_12, /* API version 1.2, linux/freebsd VF driver */
5151
ixgbe_mbox_api_13, /* API version 1.3, linux/freebsd VF driver */
5252
ixgbe_mbox_api_14, /* API version 1.4, linux/freebsd VF driver */
53+
ixgbe_mbox_api_15, /* API version 1.5, linux/freebsd VF driver */
54+
ixgbe_mbox_api_16, /* API version 1.6, linux/freebsd VF driver */
5355
/* This value should always be last */
5456
ixgbe_mbox_api_unknown, /* indicates that API version is not known */
5557
};
@@ -86,6 +88,9 @@ enum ixgbe_pfvf_api_rev {
8688

8789
#define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */
8890

91+
/* mailbox API, version 1.6 VF requests */
92+
#define IXGBE_VF_GET_PF_LINK_STATE 0x11 /* request PF to send link info */
93+
8994
/* length of permanent address message returned from PF */
9095
#define IXGBE_VF_PERMADDR_MSG_LEN 4
9196
/* word in permanent address message with the current multicast type */

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf
510510
case ixgbe_mbox_api_12:
511511
case ixgbe_mbox_api_13:
512512
case ixgbe_mbox_api_14:
513+
case ixgbe_mbox_api_16:
513514
/* Version 1.1 supports jumbo frames on VFs if PF has
514515
* jumbo frames enabled which means legacy VFs are
515516
* disabled
@@ -1046,6 +1047,7 @@ static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter,
10461047
case ixgbe_mbox_api_12:
10471048
case ixgbe_mbox_api_13:
10481049
case ixgbe_mbox_api_14:
1050+
case ixgbe_mbox_api_16:
10491051
adapter->vfinfo[vf].vf_api = api;
10501052
return 0;
10511053
default:
@@ -1072,6 +1074,7 @@ static int ixgbe_get_vf_queues(struct ixgbe_adapter *adapter,
10721074
case ixgbe_mbox_api_12:
10731075
case ixgbe_mbox_api_13:
10741076
case ixgbe_mbox_api_14:
1077+
case ixgbe_mbox_api_16:
10751078
break;
10761079
default:
10771080
return -1;
@@ -1112,6 +1115,7 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
11121115

11131116
/* verify the PF is supporting the correct API */
11141117
switch (adapter->vfinfo[vf].vf_api) {
1118+
case ixgbe_mbox_api_16:
11151119
case ixgbe_mbox_api_14:
11161120
case ixgbe_mbox_api_13:
11171121
case ixgbe_mbox_api_12:
@@ -1145,6 +1149,7 @@ static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter,
11451149

11461150
/* verify the PF is supporting the correct API */
11471151
switch (adapter->vfinfo[vf].vf_api) {
1152+
case ixgbe_mbox_api_16:
11481153
case ixgbe_mbox_api_14:
11491154
case ixgbe_mbox_api_13:
11501155
case ixgbe_mbox_api_12:
@@ -1174,6 +1179,7 @@ static int ixgbe_update_vf_xcast_mode(struct ixgbe_adapter *adapter,
11741179
fallthrough;
11751180
case ixgbe_mbox_api_13:
11761181
case ixgbe_mbox_api_14:
1182+
case ixgbe_mbox_api_16:
11771183
break;
11781184
default:
11791185
return -EOPNOTSUPP;
@@ -1244,6 +1250,7 @@ static int ixgbe_get_vf_link_state(struct ixgbe_adapter *adapter,
12441250
case ixgbe_mbox_api_12:
12451251
case ixgbe_mbox_api_13:
12461252
case ixgbe_mbox_api_14:
1253+
case ixgbe_mbox_api_16:
12471254
break;
12481255
default:
12491256
return -EOPNOTSUPP;
@@ -1254,6 +1261,38 @@ static int ixgbe_get_vf_link_state(struct ixgbe_adapter *adapter,
12541261
return 0;
12551262
}
12561263

1264+
/**
1265+
* ixgbe_send_vf_link_status - send link status data to VF
1266+
* @adapter: pointer to adapter struct
1267+
* @msgbuf: pointer to message buffers
1268+
* @vf: VF identifier
1269+
*
1270+
* Reply for IXGBE_VF_GET_PF_LINK_STATE mbox command sending link status data.
1271+
*
1272+
* Return: 0 on success or -EOPNOTSUPP when operation is not supported.
1273+
*/
1274+
static int ixgbe_send_vf_link_status(struct ixgbe_adapter *adapter,
1275+
u32 *msgbuf, u32 vf)
1276+
{
1277+
struct ixgbe_hw *hw = &adapter->hw;
1278+
1279+
switch (adapter->vfinfo[vf].vf_api) {
1280+
case ixgbe_mbox_api_16:
1281+
if (hw->mac.type != ixgbe_mac_e610)
1282+
return -EOPNOTSUPP;
1283+
break;
1284+
default:
1285+
return -EOPNOTSUPP;
1286+
}
1287+
/* Simply provide stored values as watchdog & link status events take
1288+
* care of its freshness.
1289+
*/
1290+
msgbuf[1] = adapter->link_speed;
1291+
msgbuf[2] = adapter->link_up;
1292+
1293+
return 0;
1294+
}
1295+
12571296
static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
12581297
{
12591298
u32 mbx_size = IXGBE_VFMAILBOX_SIZE;
@@ -1328,6 +1367,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
13281367
case IXGBE_VF_IPSEC_DEL:
13291368
retval = ixgbe_ipsec_vf_del_sa(adapter, msgbuf, vf);
13301369
break;
1370+
case IXGBE_VF_GET_PF_LINK_STATE:
1371+
retval = ixgbe_send_vf_link_status(adapter, msgbuf, vf);
1372+
break;
13311373
default:
13321374
e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
13331375
retval = -EIO;

0 commit comments

Comments
 (0)