Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

octeon_ep: support to fetch firmware info

Add support to fetch firmware info such as heartbeat miss count,
heartbeat interval. This shall be used for heartbeat monitor.

Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shinas Rasheed and committed by
David S. Miller
8d6198a1 d692873c

+77 -17
+3 -7
drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
··· 16 16 #define CTRL_MBOX_MAX_PF 128 17 17 #define CTRL_MBOX_SZ ((size_t)(0x400000 / CTRL_MBOX_MAX_PF)) 18 18 19 - #define FW_HB_INTERVAL_IN_SECS 1 20 - #define FW_HB_MISS_COUNT 10 21 - 22 19 /* Names of Hardware non-queue generic interrupts */ 23 20 static char *cn93_non_ioq_msix_names[] = { 24 21 "epf_ire_rint", ··· 247 250 link = PCI_DEVFN(PCI_SLOT(oct->pdev->devfn), link); 248 251 } 249 252 conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr + 250 - (0x400000ull * 7) + 253 + CN93_PEM_BAR4_INDEX_OFFSET + 251 254 (link * CTRL_MBOX_SZ); 252 255 253 - conf->hb_interval = FW_HB_INTERVAL_IN_SECS; 254 - conf->max_hb_miss_cnt = FW_HB_MISS_COUNT; 255 - 256 + conf->fw_info.hb_interval = OCTEP_DEFAULT_FW_HB_INTERVAL; 257 + conf->fw_info.hb_miss_count = OCTEP_DEFAULT_FW_HB_MISS_COUNT; 256 258 } 257 259 258 260 /* Setup registers for a hardware Tx Queue */
+17 -5
drivers/net/ethernet/marvell/octeon_ep/octep_config.h
··· 49 49 /* Default MTU */ 50 50 #define OCTEP_DEFAULT_MTU 1500 51 51 52 + /* pf heartbeat interval in milliseconds */ 53 + #define OCTEP_DEFAULT_FW_HB_INTERVAL 1000 54 + /* pf heartbeat miss count */ 55 + #define OCTEP_DEFAULT_FW_HB_MISS_COUNT 20 56 + 52 57 /* Macros to get octeon config params */ 53 58 #define CFG_GET_IQ_CFG(cfg) ((cfg)->iq) 54 59 #define CFG_GET_IQ_NUM_DESC(cfg) ((cfg)->iq.num_descs) ··· 186 181 void __iomem *barmem_addr; 187 182 }; 188 183 184 + /* Info from firmware */ 185 + struct octep_fw_info { 186 + /* interface pkind */ 187 + u16 pkind; 188 + /* heartbeat interval in milliseconds */ 189 + u16 hb_interval; 190 + /* heartbeat miss count */ 191 + u16 hb_miss_count; 192 + }; 193 + 189 194 /* Data Structure to hold configuration limits and active config */ 190 195 struct octep_config { 191 196 /* Input Queue attributes. */ ··· 216 201 /* ctrl mbox config */ 217 202 struct octep_ctrl_mbox_config ctrl_mbox_cfg; 218 203 219 - /* Configured maximum heartbeat miss count */ 220 - u32 max_hb_miss_cnt; 221 - 222 - /* Configured firmware heartbeat interval in secs */ 223 - u32 hb_interval; 204 + /* fw info */ 205 + struct octep_fw_info fw_info; 224 206 }; 225 207 #endif /* _OCTEP_CONFIG_H_ */
+23 -1
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
··· 26 26 27 27 /* Control plane version in which OCTEP_CTRL_NET_H2F_CMD was added */ 28 28 static const u32 octep_ctrl_net_h2f_cmd_versions[OCTEP_CTRL_NET_H2F_CMD_MAX] = { 29 - [OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_LINK_INFO] = 29 + [OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_GET_INFO] = 30 30 OCTEP_CP_VERSION(1, 0, 0) 31 31 }; 32 32 ··· 351 351 else if (msg.hdr.s.flags & OCTEP_CTRL_MBOX_MSG_HDR_FLAG_NOTIFY) 352 352 process_mbox_notify(oct, &msg); 353 353 } 354 + } 355 + 356 + int octep_ctrl_net_get_info(struct octep_device *oct, int vfid, 357 + struct octep_fw_info *info) 358 + { 359 + struct octep_ctrl_net_wait_data d = {0}; 360 + struct octep_ctrl_net_h2f_resp *resp; 361 + struct octep_ctrl_net_h2f_req *req; 362 + int err; 363 + 364 + req = &d.data.req; 365 + init_send_req(&d.msg, req, 0, vfid); 366 + req->hdr.s.cmd = OCTEP_CTRL_NET_H2F_CMD_GET_INFO; 367 + req->link_info.cmd = OCTEP_CTRL_NET_CMD_GET; 368 + err = octep_send_mbox_req(oct, &d, true); 369 + if (err < 0) 370 + return err; 371 + 372 + resp = &d.data.resp; 373 + memcpy(info, &resp->info.fw_info, sizeof(struct octep_fw_info)); 374 + 375 + return 0; 354 376 } 355 377 356 378 int octep_ctrl_net_uninit(struct octep_device *oct)
+18
drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
··· 41 41 OCTEP_CTRL_NET_H2F_CMD_LINK_STATUS, 42 42 OCTEP_CTRL_NET_H2F_CMD_RX_STATE, 43 43 OCTEP_CTRL_NET_H2F_CMD_LINK_INFO, 44 + OCTEP_CTRL_NET_H2F_CMD_GET_INFO, 44 45 OCTEP_CTRL_NET_H2F_CMD_MAX 45 46 }; 46 47 ··· 162 161 u16 state; 163 162 }; 164 163 164 + /* get info request */ 165 + struct octep_ctrl_net_h2f_resp_cmd_get_info { 166 + struct octep_fw_info fw_info; 167 + }; 168 + 165 169 /* Host to fw response data */ 166 170 struct octep_ctrl_net_h2f_resp { 167 171 union octep_ctrl_net_resp_hdr hdr; ··· 177 171 struct octep_ctrl_net_h2f_resp_cmd_state link; 178 172 struct octep_ctrl_net_h2f_resp_cmd_state rx; 179 173 struct octep_ctrl_net_link_info link_info; 174 + struct octep_ctrl_net_h2f_resp_cmd_get_info info; 180 175 }; 181 176 } __packed; 182 177 ··· 336 329 * @param oct: non-null pointer to struct octep_device. 337 330 */ 338 331 void octep_ctrl_net_recv_fw_messages(struct octep_device *oct); 332 + 333 + /** Get info from firmware. 334 + * 335 + * @param oct: non-null pointer to struct octep_device. 336 + * @param vfid: Index of virtual function. 337 + * @param info: non-null pointer to struct octep_fw_info. 338 + * 339 + * return value: 0 on success, -errno on failure. 340 + */ 341 + int octep_ctrl_net_get_info(struct octep_device *oct, int vfid, 342 + struct octep_fw_info *info); 339 343 340 344 /** Uninitialize data for ctrl net. 341 345 *
+12 -4
drivers/net/ethernet/marvell/octeon_ep/octep_main.c
··· 918 918 int miss_cnt; 919 919 920 920 miss_cnt = atomic_inc_return(&oct->hb_miss_cnt); 921 - if (miss_cnt < oct->conf->max_hb_miss_cnt) { 921 + if (miss_cnt < oct->conf->fw_info.hb_miss_count) { 922 922 queue_delayed_work(octep_wq, &oct->hb_task, 923 - msecs_to_jiffies(oct->conf->hb_interval * 1000)); 923 + msecs_to_jiffies(oct->conf->fw_info.hb_interval)); 924 924 return; 925 925 } 926 926 ··· 1013 1013 1014 1014 atomic_set(&oct->hb_miss_cnt, 0); 1015 1015 INIT_DELAYED_WORK(&oct->hb_task, octep_hb_timeout_task); 1016 - queue_delayed_work(octep_wq, &oct->hb_task, 1017 - msecs_to_jiffies(oct->conf->hb_interval * 1000)); 1016 + 1018 1017 return 0; 1019 1018 1020 1019 unsupported_dev: ··· 1142 1143 dev_err(&pdev->dev, "Device setup failed\n"); 1143 1144 goto err_octep_config; 1144 1145 } 1146 + 1147 + octep_ctrl_net_get_info(octep_dev, OCTEP_CTRL_NET_INVALID_VFID, 1148 + &octep_dev->conf->fw_info); 1149 + dev_info(&octep_dev->pdev->dev, "Heartbeat interval %u msecs Heartbeat miss count %u\n", 1150 + octep_dev->conf->fw_info.hb_interval, 1151 + octep_dev->conf->fw_info.hb_miss_count); 1152 + queue_delayed_work(octep_wq, &octep_dev->hb_task, 1153 + msecs_to_jiffies(octep_dev->conf->fw_info.hb_interval)); 1154 + 1145 1155 INIT_WORK(&octep_dev->tx_timeout_task, octep_tx_timeout_task); 1146 1156 INIT_WORK(&octep_dev->ctrl_mbox_task, octep_ctrl_mbox_task); 1147 1157 INIT_DELAYED_WORK(&octep_dev->intr_poll_task, octep_intr_poll_task);
+4
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
··· 370 370 /* bit 1 for firmware heartbeat interrupt */ 371 371 #define CN93_SDP_EPF_OEI_RINT_DATA_BIT_HBEAT BIT_ULL(1) 372 372 373 + #define CN93_PEM_BAR4_INDEX 7 374 + #define CN93_PEM_BAR4_INDEX_SIZE 0x400000ULL 375 + #define CN93_PEM_BAR4_INDEX_OFFSET (CN93_PEM_BAR4_INDEX * CN93_PEM_BAR4_INDEX_SIZE) 376 + 373 377 #endif /* _OCTEP_REGS_CN9K_PF_H_ */