Re: [PATCH 2/3] hv_netvsc: Wait for completion on request NVSP_MSG4_TYPE_SWITCH_DATA_PATH

From: kernel test robot
Date: Tue Jan 05 2021 - 23:27:28 EST


Hi Long,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11-rc2 next-20210104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Long-Li/hv_netvsc-Check-VF-datapath-when-sending-traffic-to-VF/20210106-092237
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8c92b5574da1b0c2aee3eab7da2c4dad8d92572c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Long-Li/hv_netvsc-Check-VF-datapath-when-sending-traffic-to-VF/20210106-092237
git checkout 8c92b5574da1b0c2aee3eab7da2c4dad8d92572c
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/net/hyperv/netvsc.c: In function 'netvsc_send_completion':
>> drivers/net/hyperv/netvsc.c:778:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
778 | pkt_rqst = (struct nvsp_message *)cmd_rqst;
| ^


vim +778 drivers/net/hyperv/netvsc.c

757
758 static void netvsc_send_completion(struct net_device *ndev,
759 struct netvsc_device *net_device,
760 struct vmbus_channel *incoming_channel,
761 const struct vmpacket_descriptor *desc,
762 int budget)
763 {
764 const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
765 u32 msglen = hv_pkt_datalen(desc);
766 struct nvsp_message *pkt_rqst;
767 u64 cmd_rqst;
768
769 /* First check if this is a VMBUS completion without data payload */
770 if (!msglen) {
771 cmd_rqst = vmbus_request_addr(&incoming_channel->requestor,
772 (u64)desc->trans_id);
773 if (cmd_rqst == VMBUS_RQST_ERROR) {
774 netdev_err(ndev, "Invalid transaction id\n");
775 return;
776 }
777
> 778 pkt_rqst = (struct nvsp_message *)cmd_rqst;
779 switch (pkt_rqst->hdr.msg_type) {
780 case NVSP_MSG4_TYPE_SWITCH_DATA_PATH:
781 complete(&net_device->channel_init_wait);
782 break;
783
784 default:
785 netdev_err(ndev, "Unexpected VMBUS completion!!\n");
786 }
787 return;
788 }
789
790 /* Ensure packet is big enough to read header fields */
791 if (msglen < sizeof(struct nvsp_message_header)) {
792 netdev_err(ndev, "nvsp_message length too small: %u\n", msglen);
793 return;
794 }
795
796 switch (nvsp_packet->hdr.msg_type) {
797 case NVSP_MSG_TYPE_INIT_COMPLETE:
798 if (msglen < sizeof(struct nvsp_message_header) +
799 sizeof(struct nvsp_message_init_complete)) {
800 netdev_err(ndev, "nvsp_msg length too small: %u\n",
801 msglen);
802 return;
803 }
804 fallthrough;
805
806 case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
807 if (msglen < sizeof(struct nvsp_message_header) +
808 sizeof(struct nvsp_1_message_send_receive_buffer_complete)) {
809 netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
810 msglen);
811 return;
812 }
813 fallthrough;
814
815 case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
816 if (msglen < sizeof(struct nvsp_message_header) +
817 sizeof(struct nvsp_1_message_send_send_buffer_complete)) {
818 netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
819 msglen);
820 return;
821 }
822 fallthrough;
823
824 case NVSP_MSG5_TYPE_SUBCHANNEL:
825 if (msglen < sizeof(struct nvsp_message_header) +
826 sizeof(struct nvsp_5_subchannel_complete)) {
827 netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
828 msglen);
829 return;
830 }
831 /* Copy the response back */
832 memcpy(&net_device->channel_init_pkt, nvsp_packet,
833 sizeof(struct nvsp_message));
834 complete(&net_device->channel_init_wait);
835 break;
836
837 case NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE:
838 netvsc_send_tx_complete(ndev, net_device, incoming_channel,
839 desc, budget);
840 break;
841
842 default:
843 netdev_err(ndev,
844 "Unknown send completion type %d received!!\n",
845 nvsp_packet->hdr.msg_type);
846 }
847 }
848

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip