Motr  M0
ulnet_core.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
488 #include <sys/types.h>
489 #include <sys/stat.h>
490 #include <sys/ioctl.h>
491 #include <fcntl.h>
492 #include <unistd.h> /* close */
493 #include "lib/errno.h" /* EADDRINUSE */
494 
502 static const char *nlx_ucore_dev_name = "/dev/" M0_LNET_DEV;
503 
507 static bool nlx_ucore_domain_invariant(const struct nlx_ucore_domain *ud)
508 {
509  return ud != NULL && ud->ud_magic == M0_NET_LNET_UCORE_DOM_MAGIC &&
510  ud->ud_fd >= 0 &&
511  ud->ud_max_buffer_size > 0 &&
512  ud->ud_max_buffer_segment_size > 0 &&
513  ud->ud_max_buffer_segments > 0;
514 }
515 
519 static bool nlx_ucore_buffer_invariant(const struct nlx_ucore_buffer *ub)
520 {
521  return ub != NULL && ub->ub_magic == M0_NET_LNET_UCORE_BUF_MAGIC;
522 }
523 
527 static bool nlx_ucore_tm_invariant(const struct nlx_ucore_transfer_mc *utm)
528 {
529  return utm != NULL && utm->utm_magic == M0_NET_LNET_UCORE_TM_MAGIC;
530 }
531 
532 M0_INTERNAL void *nlx_core_mem_alloc(size_t size, unsigned shift)
533 {
534  return m0_alloc_wired(size, shift);
535 }
536 
537 M0_INTERNAL void nlx_core_mem_free(void *data, size_t size, unsigned shift)
538 {
539  m0_free_wired(data, size, shift);
540 }
541 
548 static int nlx_ucore_ioctl(int fd, unsigned long cmd, void *arg)
549 {
550  int rc;
551 
552  M0_PRE(fd >= 0);
553  M0_PRE(_IOC_TYPE(cmd) == M0_LNET_IOC_MAGIC);
554  M0_PRE(_IOC_NR(cmd) >= M0_LNET_IOC_MIN_NR);
555  M0_PRE(_IOC_NR(cmd) <= M0_LNET_IOC_MAX_NR);
556 
557  rc = ioctl(fd, cmd, arg);
558  if (rc >= 0)
559  return M0_RC(rc);
560  M0_ASSERT_INFO(errno > 0, "errno=%d", errno);
561  M0_ASSERT_INFO(_0C(errno != EFAULT) && _0C(errno != EBADR),
562  "errno=%d", errno);
563  return M0_RC(-errno);
564 }
565 
570 static unsigned nlx_ucore_nidstrs_thunk = 128;
571 
579 static int nlx_ucore_nidstrs_get(struct nlx_ucore_domain *ud, char ***nidary)
580 {
581  struct m0_lnet_dev_nidstrs_get_params dngp;
582  unsigned i;
583  char *p;
584  char **nidstrs;
585  unsigned nidstrs_nr;
586  int rc;
587 
588  M0_PRE(ud != NULL && ud->ud_fd >= 0);
589 
590  /* Repeat until the buffer is large enough to hold all the strings. */
591  for (i = 0, dngp.dng_buf = NULL; dngp.dng_buf == NULL; ++i) {
593  NLX_ALLOC_ARR(dngp.dng_buf, dngp.dng_size);
594  if (dngp.dng_buf == NULL)
595  return M0_ERR(-ENOMEM);
597  if (rc < 0) {
598  m0_free0(&dngp.dng_buf);
599  if (rc != -EFBIG)
600  return M0_RC(rc);
601  }
602  }
603  nidstrs_nr = rc;
604 
605  /* Create a string array. */
606  NLX_ALLOC_ARR(nidstrs, nidstrs_nr + 1);
607  if (nidstrs == NULL) {
608  m0_free(dngp.dng_buf);
609  return M0_ERR(-ENOMEM);
610  }
611  for (i = 0, p = dngp.dng_buf; i < nidstrs_nr; ++i, ++p) {
612  nidstrs[i] = p;
613  while (*p != '\0')
614  ++p;
615  }
616  nidstrs[nidstrs_nr] = NULL;
617 
618  *nidary = nidstrs;
619  return 0;
620 }
621 
625 static void nlx_ucore_nidstrs_put(struct nlx_ucore_domain *ud, char ***nidary)
626 {
627  M0_PRE(nidary != NULL);
628  m0_free((*nidary)[0]); /* string buffer */
629  m0_free0(nidary); /* string array */
630 }
631 
632 
633 M0_INTERNAL int nlx_core_dom_init(struct m0_net_domain *dom,
634  struct nlx_core_domain *cd)
635 {
636  static const struct {
637  int err;
638  const char *err_str;
639  const char *err_help;
640  } possible_open_errors[] = {
641  { EACCES, "EACCES", "Please check permissions." },
642  { ENOENT, "ENOENT", "Please ensure that m0tr.ko is loaded." },
643  };
644  struct nlx_ucore_domain *ud;
645  struct m0_lnet_dev_dom_init_params ip = {
646  .ddi_cd = cd,
647  };
648  int rc;
649  int i;
650 
651  M0_PRE(dom != NULL && cd != NULL);
652  M0_PRE(cd->cd_kpvt == NULL && cd->cd_upvt == NULL);
653  NLX_ALLOC_PTR(ud);
654  if (ud == NULL)
655  return M0_ERR(-ENOMEM);
656  ud->ud_fd = open(nlx_ucore_dev_name, O_RDWR|O_CLOEXEC);
657  if (ud->ud_fd == -1) {
658  M0_ASSERT(errno != 0);
659  rc = -errno;
660  M0_ASSERT(rc < 0);
661  for (i = 0; i < ARRAY_SIZE(possible_open_errors); ++i) {
662  if (possible_open_errors[i].err == -rc) {
664  "open(\"%s\", O_RDWR|O_CLOEXEC) failed: "
665  "errno=%d (%s). %s" ,
667  possible_open_errors[i].err_str,
668  possible_open_errors[i].err_help);
669  goto fail_open;
670  }
671  }
672  M0_LOG(M0_ERROR, "open(\"%s\", O_RDWR|O_CLOEXEC) failed: "
673  "errno=%d", nlx_ucore_dev_name, -rc);
674  goto fail_open;
675  }
676 
678  if (rc < 0)
679  goto fail_dom_init;
680  M0_ASSERT(cd->cd_kpvt != NULL);
681 
682  /* cache buffer size constants */
683 #define NLX_IP_SET(f) ud->ud_##f = ip.ddi_##f
684  NLX_IP_SET(max_buffer_size);
685  NLX_IP_SET(max_buffer_segment_size);
686  NLX_IP_SET(max_buffer_segments);
687 #undef NLX_IP_SET
688 
690  cd->cd_upvt = ud;
691 
693  return 0;
694 
695  fail_dom_init:
696  close(ud->ud_fd);
697  fail_open:
698  m0_free(ud);
699  M0_POST(cd->cd_kpvt == NULL && cd->cd_upvt == NULL);
700  return M0_RC(rc);
701 }
702 
703 M0_INTERNAL void nlx_core_dom_fini(struct nlx_core_domain *cd)
704 {
705  struct nlx_ucore_domain *ud;
706 
707  M0_PRE(cd != NULL);
708  ud = cd->cd_upvt;
710 
711  close(ud->ud_fd);
712  ud->ud_magic = 0;
713  m0_free0(&cd->cd_upvt);
714  cd->cd_kpvt = NULL;
715 }
716 
718 {
719  struct nlx_ucore_domain *ud;
720 
721  M0_PRE(cd != NULL);
722  ud = cd->cd_upvt;
724  return ud->ud_max_buffer_size;
725 }
726 
729  *cd)
730 {
731  struct nlx_ucore_domain *ud;
732 
733  M0_PRE(cd != NULL);
734  ud = cd->cd_upvt;
736  return ud->ud_max_buffer_segment_size;
737 }
738 
739 M0_INTERNAL int32_t nlx_core_get_max_buffer_segments(struct nlx_core_domain *cd)
740 {
741  struct nlx_ucore_domain *ud;
742 
743  M0_PRE(cd != NULL);
744  ud = cd->cd_upvt;
746  return ud->ud_max_buffer_segments;
747 }
748 
749 M0_INTERNAL int nlx_core_buf_register(struct nlx_core_domain *cd,
750  nlx_core_opaque_ptr_t buffer_id,
751  const struct m0_bufvec *bvec,
752  struct nlx_core_buffer *cb)
753 {
754  int rc;
755  struct nlx_ucore_buffer *ub;
756  struct nlx_ucore_domain *ud;
757  struct m0_lnet_dev_buf_register_params rp = {
758  .dbr_lcbuf = cb,
759  .dbr_buffer_id = buffer_id,
760  };
761 
762  M0_PRE(cd != NULL);
763  ud = cd->cd_upvt;
765  M0_PRE(buffer_id != 0);
766  M0_PRE(bvec != NULL);
767  M0_PRE(cb != NULL);
768  M0_PRE(cb->cb_kpvt == NULL && cb->cb_upvt == NULL);
769 
770  NLX_ALLOC_PTR(ub);
771  if (ub == NULL)
772  return M0_ERR(-ENOMEM);
775  cb->cb_upvt = ub;
776 
777  rp.dbr_bvec = *bvec;
779  if (rc < 0) {
780  cb->cb_upvt = NULL;
781  ub->ub_magic = 0;
782  m0_free(ub);
783  return M0_RC(rc);
784  }
785  M0_ASSERT(cb->cb_kpvt != NULL);
786  M0_ASSERT(cb->cb_upvt == ub);
787 
789  return 0;
790 }
791 
792 M0_INTERNAL void nlx_core_buf_deregister(struct nlx_core_domain *cd,
793  struct nlx_core_buffer *cb)
794 {
795  struct nlx_ucore_buffer *ub;
796  struct nlx_ucore_domain *ud;
798  int rc;
799 
800  M0_PRE(cd != NULL);
801  ud = cd->cd_upvt;
803 
805  ub = cb->cb_upvt;
807  M0_PRE(cb->cb_kpvt != NULL);
808  dp.dbd_kb = cb->cb_kpvt;
810  M0_ASSERT(rc == 0);
811 
812  ub->ub_magic = 0;
813  m0_free(ub);
814 
815  cb->cb_kpvt = NULL;
816  cb->cb_upvt = NULL;
817  return;
818 }
819 
820 #define NLX_UCORE_BUF_OP(op, loc, ...) \
821  struct nlx_ucore_domain *ud; \
822  struct nlx_ucore_transfer_mc *utm; \
823  struct nlx_ucore_buffer *ub; \
824  struct m0_lnet_dev_buf_queue_params dbqp; \
825  int rc = 0; \
826  \
827  M0_PRE(cd != NULL); \
828  ud = cd->cd_upvt; \
829  M0_PRE(nlx_ucore_domain_invariant(ud)); \
830  \
831  M0_PRE(nlx_core_tm_invariant(ctm)); \
832  utm = ctm->ctm_upvt; \
833  M0_PRE(nlx_ucore_tm_invariant(utm)); \
834  \
835  M0_PRE(nlx_core_buffer_invariant(cb)); \
836  ub = cb->cb_upvt; \
837  M0_PRE(nlx_ucore_buffer_invariant(ub)); \
838  \
839  __VA_ARGS__; \
840  \
841  dbqp.dbq_ktm = ctm->ctm_kpvt; \
842  dbqp.dbq_kb = cb->cb_kpvt; \
843  rc = nlx_ucore_ioctl(ud->ud_fd, op, &dbqp)
844 
845 M0_INTERNAL int nlx_core_buf_msg_recv(struct nlx_core_domain *cd,
846  struct nlx_core_transfer_mc *ctm,
847  struct nlx_core_buffer *cb)
848 {
851  M0_PRE(cb->cb_length > 0);
853  M0_PRE(cb->cb_max_operations > 0);
854  );
855  return M0_RC(rc);
856 }
857 
858 M0_INTERNAL int nlx_core_buf_msg_send(struct nlx_core_domain *cd,
859  struct nlx_core_transfer_mc *ctm,
860  struct nlx_core_buffer *cb)
861 {
864  M0_PRE(cb->cb_length > 0);
865  M0_PRE(cb->cb_max_operations == 1);
866  );
867  return M0_RC(rc);
868 }
869 
870 M0_INTERNAL int nlx_core_buf_active_recv(struct nlx_core_domain *cd,
871  struct nlx_core_transfer_mc *ctm,
872  struct nlx_core_buffer *cb)
873 {
874  uint32_t tmid;
875  uint64_t counter;
878  M0_PRE(cb->cb_length > 0);
879  M0_PRE(cb->cb_max_operations == 1);
880  M0_PRE(cb->cb_match_bits > 0);
882  &tmid, &counter);
883  M0_PRE(tmid == cb->cb_addr.cepa_tmid);
886  );
887  return M0_RC(rc);
888 }
889 
890 M0_INTERNAL int nlx_core_buf_active_send(struct nlx_core_domain *cd,
891  struct nlx_core_transfer_mc *ctm,
892  struct nlx_core_buffer *cb)
893 {
894  uint32_t tmid;
895  uint64_t counter;
898  M0_PRE(cb->cb_length > 0);
899  M0_PRE(cb->cb_max_operations == 1);
900  M0_PRE(cb->cb_match_bits > 0);
902  &tmid, &counter);
903  M0_PRE(tmid == cb->cb_addr.cepa_tmid);
906  );
907  return M0_RC(rc);
908 }
909 
910 M0_INTERNAL int nlx_core_buf_passive_recv(struct nlx_core_domain *cd,
911  struct nlx_core_transfer_mc *ctm,
912  struct nlx_core_buffer *cb)
913 {
914  uint32_t tmid;
915  uint64_t counter;
918  M0_PRE(cb->cb_length > 0);
919  M0_PRE(cb->cb_max_operations == 1);
920  M0_PRE(cb->cb_match_bits > 0);
922  &tmid, &counter);
923  M0_PRE(tmid == ctm->ctm_addr.cepa_tmid);
926  );
927  return M0_RC(rc);
928 }
929 
930 M0_INTERNAL int nlx_core_buf_passive_send(struct nlx_core_domain *cd,
931  struct nlx_core_transfer_mc *ctm,
932  struct nlx_core_buffer *cb)
933 {
934  uint32_t tmid;
935  uint64_t counter;
938  M0_PRE(cb->cb_length > 0);
939  M0_PRE(cb->cb_max_operations == 1);
940  M0_PRE(cb->cb_match_bits > 0);
942  &tmid, &counter);
943  M0_PRE(tmid == ctm->ctm_addr.cepa_tmid);
946  );
947  return M0_RC(rc);
948 }
949 
950 M0_INTERNAL int nlx_core_buf_del(struct nlx_core_domain *cd,
951  struct nlx_core_transfer_mc *ctm,
952  struct nlx_core_buffer *cb)
953 {
954  NLX_UCORE_BUF_OP(M0_LNET_BUF_DEL, U_BUF_DEL, );
955  return M0_RC(rc);
956 }
957 
958 #undef NLX_UCORE_BUF_OP
959 
961  struct nlx_core_transfer_mc *ctm,
963 {
964  struct nlx_ucore_domain *ud;
965  struct nlx_ucore_transfer_mc *utm;
967  int rc;
968 
969  M0_PRE(cd != NULL);
970  ud = cd->cd_upvt;
972 
974  M0_PRE(ctm->ctm_kpvt != NULL);
975  utm = ctm->ctm_upvt;
977 
978  bewp.dbw_ktm = ctm->ctm_kpvt;
980  do {
982  } while (rc == -EINTR);
983  return rc < 0 ? rc : 0;
984 }
985 
986 M0_INTERNAL int nlx_core_nidstr_decode(struct nlx_core_domain *cd,
987  const char *nidstr, uint64_t * nid)
988 {
989  struct m0_lnet_dev_nid_encdec_params dnep;
990  struct nlx_ucore_domain *ud;
991  int rc;
992 
993  M0_PRE(cd != NULL);
994  ud = cd->cd_upvt;
996 
997  strncpy(dnep.dn_buf, nidstr, ARRAY_SIZE(dnep.dn_buf) - 1);
998  dnep.dn_buf[ARRAY_SIZE(dnep.dn_buf) - 1] = '\0';
999  dnep.dn_nid = 0;
1000 
1002  if (rc < 0)
1003  return M0_RC(rc);
1004 
1005  *nid = dnep.dn_nid;
1006  return 0;
1007 }
1008 
1009 M0_INTERNAL int nlx_core_nidstr_encode(struct nlx_core_domain *cd,
1010  uint64_t nid,
1011  char nidstr[M0_NET_LNET_NIDSTR_SIZE])
1012 {
1013  struct m0_lnet_dev_nid_encdec_params dnep;
1014  struct nlx_ucore_domain *ud;
1015  int rc;
1016 
1017  M0_PRE(cd != NULL);
1018  ud = cd->cd_upvt;
1020 
1021  dnep.dn_nid = nid;
1022  M0_SET_ARR0(dnep.dn_buf);
1023 
1025  if (rc < 0)
1026  return M0_ERR(rc);
1027  M0_POST(dnep.dn_buf[0] != '\0');
1028 
1029  strncpy(nidstr, dnep.dn_buf, M0_NET_LNET_NIDSTR_SIZE);
1030  nidstr[M0_NET_LNET_NIDSTR_SIZE - 1] = '\0';
1031  return 0;
1032 }
1033 
1034 /*
1035  This call is not protected by any mutex. It relies on the
1036  application to not invoke it during domain finalization.
1037  */
1038 M0_INTERNAL int nlx_core_nidstrs_get(struct nlx_core_domain *cd,
1039  char ***nidary)
1040 {
1041  struct nlx_ucore_domain *ud;
1042 
1043  M0_PRE(cd != NULL);
1044  ud = cd->cd_upvt;
1046  return nlx_ucore_nidstrs_get(ud, nidary);
1047 }
1048 
1049 M0_INTERNAL void nlx_core_nidstrs_put(struct nlx_core_domain *cd,
1050  char ***nidary)
1051 {
1052  struct nlx_ucore_domain *ud;
1053 
1054  M0_PRE(cd != NULL);
1055  ud = cd->cd_upvt;
1057  nlx_ucore_nidstrs_put(ud, nidary);
1058 }
1059 
1063 static void nlx_ucore_tm_stop(struct nlx_core_domain *cd,
1064  struct nlx_core_transfer_mc *ctm)
1065 {
1066  struct nlx_ucore_domain *ud;
1067  struct m0_lnet_dev_tm_stop_params tpp;
1068  int rc;
1069 
1070  M0_PRE(cd != NULL);
1071  ud = cd->cd_upvt;
1074  M0_PRE(ctm->ctm_kpvt != NULL);
1075  tpp.dts_ktm = ctm->ctm_kpvt;
1076 
1077  rc = nlx_ucore_ioctl(ud->ud_fd, M0_LNET_TM_STOP, &tpp);
1078  M0_ASSERT(rc == 0);
1079  return;
1080 }
1081 
1082 M0_INTERNAL int nlx_core_tm_start(struct nlx_core_domain *cd,
1083  struct m0_net_transfer_mc *tm,
1084  struct nlx_core_transfer_mc *ctm)
1085 {
1086  struct nlx_ucore_domain *ud;
1087  struct nlx_ucore_transfer_mc *utm;
1088  struct nlx_core_buffer_event *e1 = NULL;
1089  struct nlx_core_buffer_event *e2 = NULL;
1090  struct m0_lnet_dev_tm_start_params tsp = {
1091  .dts_ctm = ctm,
1092  };
1093  int rc;
1094 
1095  M0_PRE(tm != NULL);
1096  M0_PRE(m0_mutex_is_locked(&tm->ntm_mutex));
1097  M0_PRE(nlx_tm_invariant(tm));
1098 
1099  M0_PRE(cd != NULL);
1100  ud = cd->cd_upvt;
1102 
1103  M0_PRE(ctm != NULL);
1104  M0_PRE(ctm->ctm_kpvt == NULL);
1105  M0_PRE(ctm->ctm_magic == 0);
1106 
1107  NLX_ALLOC_PTR(utm);
1108  if (utm == NULL) {
1109  rc = M0_ERR(-ENOMEM);
1110  goto fail_utm;
1111  }
1114  ctm->ctm_upvt = utm;
1115 
1116  rc = nlx_ucore_ioctl(ud->ud_fd, M0_LNET_TM_START, &tsp);
1117  if (rc < 0)
1118  goto fail_start;
1119  M0_ASSERT(ctm->ctm_kpvt != NULL);
1120  M0_ASSERT(ctm->ctm_upvt == utm);
1121 
1122  rc = nlx_core_new_blessed_bev(cd, ctm, &e1) ?:
1123  nlx_core_new_blessed_bev(cd, ctm, &e2);
1124  if (rc != 0)
1125  goto fail_blessed_bev;
1126  M0_ASSERT(e1 != NULL && e2 != NULL);
1127  bev_cqueue_init(&ctm->ctm_bevq, &e1->cbe_tm_link, &e2->cbe_tm_link);
1129 
1131  M0_POST(ctm->ctm_kpvt != NULL);
1132  M0_POST(ctm->ctm_upvt == utm);
1134  return 0;
1135 
1136  fail_blessed_bev:
1137  M0_ASSERT(e2 == NULL);
1138  if (e1 != NULL)
1140  nlx_ucore_tm_stop(cd, ctm);
1141  fail_start:
1142  ctm->ctm_upvt = NULL;
1143  utm->utm_magic = 0;
1144  m0_free(utm);
1145  fail_utm:
1146  if (rc == -EADDRINUSE)
1147  return M0_ERR_INFO(rc, "The address 0x%" PRIx64 ":%"PRIu32
1148  ":%"PRIu32":%"PRIu32" is already in use "
1149  "by another process.",
1150  ctm->ctm_addr.cepa_nid,
1151  ctm->ctm_addr.cepa_pid,
1152  ctm->ctm_addr.cepa_portal,
1153  ctm->ctm_addr.cepa_tmid);
1154  return M0_ERR(rc);
1155 }
1156 
1157 M0_INTERNAL void nlx_core_tm_stop(struct nlx_core_domain *cd,
1158  struct nlx_core_transfer_mc *ctm)
1159 {
1160  struct nlx_ucore_transfer_mc *utm;
1161 
1162  utm = ctm->ctm_upvt;
1164 
1165  nlx_ucore_tm_stop(cd, ctm); /* other invariants checked */
1167 
1168  ctm->ctm_upvt = NULL;
1169  utm->utm_magic = 0;
1170  m0_free(utm);
1171  return;
1172 }
1173 
1174 M0_INTERNAL int nlx_core_new_blessed_bev(struct nlx_core_domain *cd,
1175  struct nlx_core_transfer_mc *ctm,
1176  struct nlx_core_buffer_event **bevp)
1177 {
1178  struct nlx_core_buffer_event *bev;
1180  struct nlx_ucore_domain *ud;
1181  struct nlx_ucore_transfer_mc *utm;
1182  int rc;
1183 
1184  M0_PRE(cd != NULL);
1186  M0_PRE(ctm->ctm_kpvt != NULL);
1187  ud = cd->cd_upvt;
1189  utm = ctm->ctm_upvt;
1191 
1192  NLX_ALLOC_ALIGNED_PTR(bev);
1193  if (bev == NULL) {
1194  *bevp = NULL;
1195  return M0_ERR(-ENOMEM);
1196  }
1197 
1198  bp.dbb_ktm = ctm->ctm_kpvt;
1199  bp.dbb_bev = bev;
1201  if (rc < 0) {
1202  NLX_FREE_ALIGNED_PTR(bev);
1203  return M0_ERR(rc);
1204  }
1205  M0_ASSERT(bev->cbe_kpvt != NULL);
1206 
1207  *bevp = bev;
1208  return 0;
1209 }
1210 
1211 static void nlx_core_fini(void)
1212 {
1213  return;
1214 }
1215 
1216 static int nlx_core_init(void)
1217 {
1218  return 0;
1219 }
1220  /* ULNetCore */
1222 
1223 /*
1224  * Local variables:
1225  * c-indentation-style: "K&R"
1226  * c-basic-offset: 8
1227  * tab-width: 8
1228  * fill-column: 80
1229  * scroll-step: 1
1230  * End:
1231  */
static struct m0_addb2_philter p
Definition: consumer.c:40
#define M0_PRE(cond)
static int nlx_ucore_nidstrs_get(struct nlx_ucore_domain *ud, char ***nidary)
Definition: ulnet_core.c:579
uint64_t ub_magic
Definition: ulnet_core.h:64
struct nlx_core_bev_link cbe_tm_link
#define NULL
Definition: misc.h:38
#define M0_LNET_BUF_ACTIVE_SEND
Definition: lnet_ioctl.h:183
M0_INTERNAL int nlx_core_buf_passive_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:930
#define NLX_UCORE_BUF_OP(op, loc,...)
Definition: ulnet_core.c:820
M0_INTERNAL int nlx_core_buf_msg_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:858
struct nlx_core_ep_addr cb_addr
static void nlx_ucore_tm_stop(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
Definition: ulnet_core.c:1063
M0_INTERNAL int nlx_core_nidstr_decode(struct nlx_core_domain *cd, const char *nidstr, uint64_t *nid)
Definition: ulnet_core.c:986
M0_INTERNAL int nlx_core_buf_register(struct nlx_core_domain *cd, nlx_core_opaque_ptr_t buffer_id, const struct m0_bufvec *bvec, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:749
uint64_t m0_time_t
Definition: time.h:37
m0_bcount_t ud_max_buffer_size
Definition: ulnet_core.h:42
#define M0_LOG(level,...)
Definition: trace.h:167
static void nlx_core_match_bits_decode(uint64_t mb, uint32_t *tmid, uint64_t *counter)
Definition: lnet_core.c:258
static bool nlx_core_buffer_invariant(const struct nlx_core_buffer *lcb)
Definition: lnet_core.c:149
#define M0_LNET_TM_STOP
Definition: lnet_ioctl.h:203
#define M0_LNET_BUF_MSG_SEND
Definition: lnet_ioctl.h:179
#define M0_LNET_BUF_REGISTER
Definition: lnet_ioctl.h:173
struct m0_bufvec data
Definition: di.c:40
M0_INTERNAL void * m0_alloc_wired(size_t size, unsigned shift)
Definition: memory.c:202
static void bev_cqueue_init(struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *ql1, struct nlx_core_bev_link *ql2)
Definition: bev_cqueue.c:658
#define M0_LNET_NIDSTR_ENCODE
Definition: lnet_ioctl.h:196
#define NLX_ALLOC_PTR(ptr)
Definition: lnet_core.h:638
uint64_t ud_magic
Definition: ulnet_core.h:40
uint64_t m0_bcount_t
Definition: types.h:77
static const char * nlx_ucore_dev_name
Definition: ulnet_core.c:502
m0_bcount_t ud_max_buffer_segment_size
Definition: ulnet_core.h:44
static bool nlx_ucore_domain_invariant(const struct nlx_ucore_domain *ud)
Definition: ulnet_core.c:507
#define PRIx64
Definition: types.h:61
M0_INTERNAL int nlx_core_buf_passive_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:910
M0_INTERNAL void nlx_core_dom_fini(struct nlx_core_domain *cd)
Definition: ulnet_core.c:703
M0_INTERNAL void nlx_core_nidstrs_put(struct nlx_core_domain *cd, char ***nidary)
Definition: ulnet_core.c:1049
#define NLX_ALLOC_ARR(ptr, nr)
Definition: lnet_core.h:639
M0_INTERNAL void m0_free_wired(void *data, size_t size, unsigned shift)
Definition: memory.c:207
return M0_RC(rc)
M0_INTERNAL int nlx_core_buf_del(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:950
uint64_t nlx_core_opaque_ptr_t
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_segment_size(struct nlx_core_domain *cd)
Definition: ulnet_core.c:727
#define M0_LNET_BUF_PASSIVE_SEND
Definition: lnet_ioctl.h:187
int i
Definition: dir.c:1033
#define M0_LNET_BUF_DEREGISTER
Definition: lnet_ioctl.h:175
#define M0_SET_ARR0(arr)
Definition: misc.h:72
struct nlx_core_ep_addr ctm_addr
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
return M0_ERR(-EOPNOTSUPP)
static void nlx_ucore_nidstrs_put(struct nlx_ucore_domain *ud, char ***nidary)
Definition: ulnet_core.c:625
#define M0_LNET_BUF_DEL
Definition: lnet_ioctl.h:189
#define m0_free0(pptr)
Definition: memory.h:77
#define M0_ASSERT(cond)
M0_INTERNAL int nlx_core_dom_init(struct m0_net_domain *dom, struct nlx_core_domain *cd)
Definition: ulnet_core.c:633
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
Definition: mutex.c:95
struct nlx_core_bev_cqueue ctm_bevq
M0_INTERNAL int nlx_core_tm_start(struct nlx_core_domain *cd, struct m0_net_transfer_mc *tm, struct nlx_core_transfer_mc *ctm)
Definition: ulnet_core.c:1082
m0_bcount_t cb_min_receive_size
char dn_buf[M0_NET_LNET_NIDSTR_SIZE]
Definition: lnet_ioctl.h:120
#define M0_LNET_NIDSTR_DECODE
Definition: lnet_ioctl.h:194
static int counter
Definition: mutex.c:32
struct nlx_core_transfer_mc * dts_ctm
Definition: lnet_ioctl.h:140
static struct m0_bufvec bvec
Definition: xcode.c:169
static struct m0_stob_domain * dom
Definition: storage.c:38
#define NLX_ALLOC_ALIGNED_PTR(ptr)
Definition: lnet_core.h:630
struct nlx_core_buffer * dbr_lcbuf
Definition: lnet_ioctl.h:58
static bool nlx_tm_invariant(const struct m0_net_transfer_mc *tm)
#define M0_LNET_DEV
Definition: lnet_ioctl.h:164
#define M0_POST(cond)
static bool bev_cqueue_is_empty(const struct nlx_core_bev_cqueue *q)
Definition: bev_cqueue.c:702
M0_INTERNAL int32_t nlx_core_get_max_buffer_segments(struct nlx_core_domain *cd)
Definition: ulnet_core.c:739
uint32_t cb_max_operations
M0_INTERNAL int nlx_core_nidstrs_get(struct nlx_core_domain *cd, char ***nidary)
Definition: ulnet_core.c:1038
#define M0_LNET_BUF_EVENT_WAIT
Definition: lnet_ioctl.h:191
static uint32_t timeout
Definition: console.c:52
static bool nlx_ucore_buffer_invariant(const struct nlx_ucore_buffer *ub)
Definition: ulnet_core.c:519
uint64_t cb_match_bits
M0_INTERNAL m0_bcount_t nlx_core_get_max_buffer_size(struct nlx_core_domain *cd)
Definition: ulnet_core.c:717
#define PRIu32
Definition: types.h:66
#define M0_LNET_BUF_PASSIVE_RECV
Definition: lnet_ioctl.h:185
static int nlx_core_init(void)
Definition: ulnet_core.c:1216
static int nlx_ucore_ioctl(int fd, unsigned long cmd, void *arg)
Definition: ulnet_core.c:548
#define M0_LNET_TM_START
Definition: lnet_ioctl.h:201
#define M0_LNET_IOC_MAX_NR
Definition: lnet_ioctl.h:168
static void bev_cqueue_fini(struct nlx_core_bev_cqueue *q, void(*free_cb)(struct nlx_core_bev_link *))
Definition: bev_cqueue.c:682
M0_INTERNAL void nlx_core_mem_free(void *data, size_t size, unsigned shift)
Definition: ulnet_core.c:537
m0_bcount_t cb_length
#define M0_LNET_NIDSTRS_GET
Definition: lnet_ioctl.h:198
#define NLX_FREE_ALIGNED_PTR(ptr)
Definition: lnet_core.h:633
m0_bcount_t size
Definition: di.c:39
#define _0C(exp)
Definition: assert.h:311
M0_INTERNAL int nlx_core_buf_active_send(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:890
#define NLX_IP_SET(f)
struct m0t1fs_filedata * fd
Definition: dir.c:1030
enum m0_net_queue_type cb_qtype
static void nlx_core_fini(void)
Definition: ulnet_core.c:1211
#define M0_ASSERT_INFO(cond, fmt,...)
#define M0_LNET_DOM_INIT
Definition: lnet_ioctl.h:170
static bool nlx_core_tm_invariant(const struct nlx_core_transfer_mc *lctm)
Definition: lnet_core.c:120
struct nlx_core_domain * ddi_cd
Definition: lnet_ioctl.h:41
static void nlx_core_bev_free_cb(struct nlx_core_bev_link *ql)
Definition: lnet_core.c:165
static struct bulkio_params * bp
Definition: bulkio_ut.c:44
M0_INTERNAL int nlx_core_new_blessed_bev(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer_event **bevp)
Definition: ulnet_core.c:1174
static bool nlx_ucore_tm_invariant(const struct nlx_ucore_transfer_mc *utm)
Definition: ulnet_core.c:527
#define M0_LNET_BEV_BLESS
Definition: lnet_ioctl.h:206
M0_INTERNAL int nlx_core_buf_msg_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:845
M0_INTERNAL void nlx_core_tm_stop(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm)
Definition: ulnet_core.c:1157
#define M0_LNET_IOC_MAGIC
Definition: lnet_ioctl.h:166
#define M0_LNET_IOC_MIN_NR
Definition: lnet_ioctl.h:167
#define M0_LNET_BUF_MSG_RECV
Definition: lnet_ioctl.h:177
M0_INTERNAL int nlx_core_buf_active_recv(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:870
void m0_free(void *data)
Definition: memory.c:146
static unsigned nlx_ucore_nidstrs_thunk
Definition: ulnet_core.c:570
M0_INTERNAL int nlx_core_nidstr_encode(struct nlx_core_domain *cd, uint64_t nid, char nidstr[M0_NET_LNET_NIDSTR_SIZE])
Definition: ulnet_core.c:1009
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
M0_INTERNAL void nlx_core_buf_deregister(struct nlx_core_domain *cd, struct nlx_core_buffer *cb)
Definition: ulnet_core.c:792
M0_INTERNAL m0_time_t m0_time_to_realtime(m0_time_t abs_time)
Definition: time.c:160
#define M0_LNET_BUF_ACTIVE_RECV
Definition: lnet_ioctl.h:181
int32_t ud_max_buffer_segments
Definition: ulnet_core.h:46
Definition: vec.h:145
M0_INTERNAL void * nlx_core_mem_alloc(size_t size, unsigned shift)
Definition: ulnet_core.c:532
int nlx_core_buf_event_wait(struct nlx_core_domain *cd, struct nlx_core_transfer_mc *ctm, m0_time_t timeout)
Definition: ulnet_core.c:960