Skip to content

Commit 9549c6c

Browse files
Rick Farringtondavem330
authored andcommitted
liquidio: fix for vf mac addr command sent to nic firmware
Change to support host<->firmware command return value. Fix for vf mac addr state command. 1. Added support for firmware commands to return a value: - previously, the returned code overlapped with host codes, thus commands were only returning 0 (success) or -1 (interpreted as timeout) - per 'response_manager.h', the error codes are split into two fields (major/minor) now, firmware commands are grouped into their own 'major' group, separate from the host's 'major' group, which allow f/w commands to return any 16-bit value 2. The command to set vf mac addr was logging a success message even if command failed. Now command uses a callback function to log the status message. 3. The command to set vf mac addr was not logging a message when set via the host 'ip' command. Now, the callback function will log an appropriate message. Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: Derek Chickles <derek.chickles@cavium.com> Signed-off-by: Satanand Burla <satananda.burla@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 71dbc34 commit 9549c6c

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

drivers/net/ethernet/cavium/liquidio/lio_core.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,20 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)
131131

132132
case OCTNET_CMD_CHANGE_MACADDR:
133133
mac = ((u8 *)&nctrl->udd[0]) + 2;
134-
netif_info(lio, probe, lio->netdev,
135-
"MACAddr changed to %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
136-
mac[0], mac[1],
137-
mac[2], mac[3],
138-
mac[4], mac[5]);
134+
if (nctrl->ncmd.s.param1) {
135+
/* vfidx is 0 based, but vf_num (param1) is 1 based */
136+
int vfidx = nctrl->ncmd.s.param1 - 1;
137+
bool mac_is_admin_assigned = nctrl->ncmd.s.param2;
138+
139+
if (mac_is_admin_assigned)
140+
netif_info(lio, probe, lio->netdev,
141+
"MAC Address %pM is configured for VF %d\n",
142+
mac, vfidx);
143+
} else {
144+
netif_info(lio, probe, lio->netdev,
145+
" MACAddr changed to %pM\n",
146+
mac);
147+
}
139148
break;
140149

141150
case OCTNET_CMD_CHANGE_MTU:

drivers/net/ethernet/cavium/liquidio/lio_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3619,7 +3619,8 @@ static int __liquidio_set_vf_mac(struct net_device *netdev, int vfidx,
36193619
nctrl.ncmd.s.param2 = (is_admin_assigned ? 1 : 0);
36203620
nctrl.ncmd.s.more = 1;
36213621
nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
3622-
nctrl.cb_fn = 0;
3622+
nctrl.netpndev = (u64)netdev;
3623+
nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
36233624
nctrl.wait_time = LIO_CMD_WAIT_TM;
36243625

36253626
nctrl.udd[0] = 0;

drivers/net/ethernet/cavium/liquidio/response_manager.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,15 @@ int lio_process_ordered_list(struct octeon_device *octeon_dev,
101101
if ((status64 & 0xff) != 0xff) {
102102
octeon_swap_8B_data(&status64, 1);
103103
if (((status64 & 0xff) != 0xff)) {
104-
status = (u32)(status64 &
105-
0xffffffffULL);
104+
/* retrieve 16-bit firmware status */
105+
status = (u32)(status64 & 0xffffULL);
106+
if (status) {
107+
status =
108+
FIRMWARE_STATUS_CODE(status);
109+
} else {
110+
/* i.e. no error */
111+
status = OCTEON_REQUEST_DONE;
112+
}
106113
}
107114
}
108115
} else if (force_quit || (sc->timeout &&

drivers/net/ethernet/cavium/liquidio/response_manager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ enum {
7878

7979
/*------------ Error codes used by host driver -----------------*/
8080
#define DRIVER_MAJOR_ERROR_CODE 0x0000
81+
/*------ Error codes used by firmware (bits 15..0 set by firmware */
82+
#define FIRMWARE_MAJOR_ERROR_CODE 0x0001
8183

8284
/** A value of 0x00000000 indicates no error i.e. success */
8385
#define DRIVER_ERROR_NONE 0x00000000
@@ -116,6 +118,9 @@ enum {
116118

117119
};
118120

121+
#define FIRMWARE_STATUS_CODE(status) \
122+
((FIRMWARE_MAJOR_ERROR_CODE << 16) | (status))
123+
119124
/** Initialize the response lists. The number of response lists to create is
120125
* given by count.
121126
* @param octeon_dev - the octeon device structure.

0 commit comments

Comments
 (0)